Skip to content

Commit

Permalink
Fixing no-deps version
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasAlabes committed Sep 30, 2016
1 parent 056b2ca commit 1e81e18
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 274 deletions.
2 changes: 1 addition & 1 deletion dev/raphael.core.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(["eve/eve"], function(eve) {
define(["eve"], function(eve) {

/*\
* Raphael
Expand Down
275 changes: 6 additions & 269 deletions raphael.no-deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
module.exports = factory(require("eve"));
else if(typeof define === 'function' && define.amd)
define([], factory);
define(["eve"], factory);
else if(typeof exports === 'object')
exports["Raphael"] = factory();
exports["Raphael"] = factory(require("eve"));
else
root["Raphael"] = factory();
})(this, function() {
root["Raphael"] = factory(root["eve"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
Expand Down Expand Up @@ -5484,270 +5484,7 @@ return /******/ (function(modules) { // webpackBootstrap
/* 2 */
/***/ function(module, exports) {

/*
* Eve 0.2.4 - JavaScript Events Library
*
* Copyright (c) 2011 Dmitry Baranovskiy (http://dmitry.baranovskiy.com/)
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
*/

(function (glob) {
var version = "0.2.4",
has = "hasOwnProperty",
separator = /[\.\/]/,
wildcard = "*",
fun = function () {},
numsort = function (a, b) {
return a - b;
},
current_event,
events = {n: {}},
/*\
* eve
[ method ]
**
* Fires event with given `name`, given scope and other parameters.
**
> Arguments
**
- name (string) name of the event, dot (`.`) or slash (`/`) separated
- scope (object) context for the event handlers
- varargs (...) the rest of arguments will be sent to event handlers
**
= (array) array of errors, if any. Each element of the array is in format:
o {
o error (string) error message
o func (function) handler that caused error
o }
\*/
eve = function (name, scope) {
var e = events,
args = Array.prototype.slice.call(arguments, 2),
listeners = eve.listeners(name),
z = 0,
f = false,
l,
indexed = [],
queue = {},
errors = [];
current_event = name;
for (var i = 0, ii = listeners.length; i < ii; i++) if ("zIndex" in listeners[i]) {
indexed.push(listeners[i].zIndex);
if (listeners[i].zIndex < 0) {
queue[listeners[i].zIndex] = listeners[i];
}
}
indexed.sort(numsort);
while (indexed[z] < 0) {
l = queue[indexed[z++]];
if (l.apply(scope, args) === f) {
return f;
}
}
for (i = 0; i < ii; i++) {
l = listeners[i];
if ("zIndex" in l) {
if (l.zIndex == indexed[z]) {
if (l.apply(scope, args) === f) {
return f;
}
do {
z++;
l = queue[indexed[z]];
if (l && l.apply(scope, args) === f) {
return f;
}
} while (l)
} else {
queue[l.zIndex] = l;
}
} else {
if (l.apply(scope, args) === f) {
return f;
}
}
}
};
/*\
* eve.listeners
[ method ]
**
* Internal method which gives you array of all event handlers that will be triggered by the given `name`.
**
> Arguments
**
- name (string) name of the event, dot (`.`) or slash (`/`) separated
**
= (array) array of event handlers
\*/
eve.listeners = function (name) {
var names = name.split(separator),
e = events,
item,
items,
k,
i,
ii,
j,
jj,
nes,
es = [e],
out = [];
for (i = 0, ii = names.length; i < ii; i++) {
nes = [];
for (j = 0, jj = es.length; j < jj; j++) {
e = es[j].n;
items = [e[names[i]], e[wildcard]];
k = 2;
while (k--) {
item = items[k];
if (item) {
nes.push(item);
out = out.concat(item.f || []);
}
}
}
es = nes;
}
return out;
};

/*\
* eve.on
[ method ]
**
* Binds given event handler with a given name. You can use wildcards “`*`” for the names:
| eve.on("*.under.*", f);
| eve("mouse.under.floor"); // triggers f
* Use @eve to trigger the listener.
**
> Arguments
**
- name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards
- f (function) event handler function
**
= (function) returned function accept one number parameter that represents z-index of the handler. It is optional feature and only used when you need to ensure that some subset of handlers will be invoked in a given order, despite of the order of assignment.
> Example:
| eve.on("mouse", eat)(2);
| eve.on("mouse", scream);
| eve.on("mouse", catch)(1);
* This will ensure that `catch` function will be called before `eat`.
* If you want to put you hadler before not indexed handlers specify negative value.
* Note: I assume most of the time you don’t need to worry about z-index, but it’s nice to have this feature “just in case”.
\*/
eve.on = function (name, f) {
var names = name.split(separator),
e = events;
for (var i = 0, ii = names.length; i < ii; i++) {
e = e.n;
!e[names[i]] && (e[names[i]] = {n: {}});
e = e[names[i]];
}
e.f = e.f || [];
for (i = 0, ii = e.f.length; i < ii; i++) if (e.f[i] == f) {
return fun;
}
e.f.push(f);
return function (zIndex) {
if (+zIndex == +zIndex) {
f.zIndex = +zIndex;
}
};
};
/*\
* eve.nt
[ method ]
**
* Could be used inside event handler to figure out actual name of the event.
**
> Arguments
**
- subname (string) #optional subname of the event
**
= (string) name of the event, if `subname` is not specified
* or
= (boolean) `true`, if current event’s name contains `subname`
\*/
eve.nt = function (subname) {
if (subname) {
return new RegExp("(?:\\.|\\/|^)" + subname + "(?:\\.|\\/|$)").test(current_event);
}
return current_event;
};
/*\
* eve.unbind
[ method ]
**
* Removes given function from the list of event listeners assigned to given name.
**
> Arguments
**
- name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards
- f (function) event handler function
\*/
eve.unbind = function (name, f) {
var names = name.split(separator),
e,
key,
splice,
cur = [events];
for (var i = 0, ii = names.length; i < ii; i++) {
for (var j = 0; j < cur.length; j += splice.length - 2) {
splice = [j, 1];
e = cur[j].n;
if (names[i] != wildcard) {
if (e[names[i]]) {
splice.push(e[names[i]]);
}
} else {
for (key in e) if (e[has](key)) {
splice.push(e[key]);
}
}
cur.splice.apply(cur, splice);
}
}
for (i = 0, ii = cur.length; i < ii; i++) {
e = cur[i];
while (e.n) {
if (f) {
if (e.f) {
for (i = 0, ii = e.f.length; i < ii; i++) if (e.f[i] == f) {
e.f.splice(i, 1);
break;
}
!e.f.length && delete e.f;
}
for (key in e.n) if (e.n[has](key) && e.n[key].f) {
var funcs = e.n[key].f;
for (i = 0, ii = funcs.length; i < ii; i++) if (funcs[i] == f) {
funcs.splice(i, 1);
break;
}
!funcs.length && delete e.n[key].f;
}
} else {
delete e.f;
for (key in e.n) if (e.n[has](key) && e.n[key].f) {
delete e.n[key].f;
}
}
e = e.n;
}
}
};
/*\
* eve.version
[ property (string) ]
**
* Current version of the library.
\*/
eve.version = version;
eve.toString = function () {
return "You are running Eve " + version;
};
(typeof module != "undefined" && module.exports) ? (module.exports = eve) : (glob.eve = eve);
})(this);
module.exports = __WEBPACK_EXTERNAL_MODULE_2__;

/***/ },
/* 3 */
Expand Down
6 changes: 3 additions & 3 deletions raphael.no-deps.min.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ module.exports = {
},

resolve: {
modulesDirectories: ["bower_components"]
modulesDirectories: ["bower_components"],
alias: {
"eve": "eve/eve"
}
}
};

0 comments on commit 1e81e18

Please sign in to comment.