fishbone
Advanced tools
Comparing version 1.0.0 to 1.0.1
// Fishbone.js | ||
// | ||
// Version: 1.0.0 | ||
// Version: 1.0.1 | ||
// URL: https://github.com/aemkei/fishbone.js | ||
@@ -32,6 +32,6 @@ // Author: Martin Kleppe <kleppe@ubilabs.net> | ||
// trigger a given event | ||
target.trigger = function(event, data, value){ | ||
target.trigger = function(event, data){ | ||
for ( | ||
// cycle through all listerners for a given event | ||
value = observers[event], key = 0; | ||
var value = observers[event], key = 0; | ||
value && key < value.length; | ||
@@ -38,0 +38,0 @@ ){ |
@@ -1,1 +0,1 @@ | ||
Model=function a(b,c,d,e){function f(){var a=this,f={};a.on=function(a,b){(f[a]||(f[a]=[])).push(b)},a.trigger=function(a,b,d){for(d=f[a],c=0;d&&c<d.length;)d[c++](b)},a.off=function(a,b){for(d=f[a]||[];b&&(c=d.indexOf(b))>-1;)d.splice(c,1);f[a]=b?d:[]};for(c in b)d=b[c],a[c]=typeof d=="function"?function(){return(d=this.apply(a,arguments))===e?a:d}.bind(d):d;a.init&&a.init.apply(a,arguments)}return f.extend=function(f){d={};for(c in b)d[c]=b[c];for(c in f)d[c]=f[c],b[c]!==e&&(d["__"+c]=b[c]);return a(d)},f},typeof module=="object"&&(module.exports=Model); | ||
Model=function a(b,c,d,e){function f(){var a=this,f={};a.on=function(a,b){(f[a]||(f[a]=[])).push(b)},a.trigger=function(a,b){for(var c=f[a],d=0;c&&d<c.length;)c[d++](b)},a.off=function(a,b){for(d=f[a]||[];b&&(c=d.indexOf(b))>-1;)d.splice(c,1);f[a]=b?d:[]};for(c in b)d=b[c],a[c]=typeof d=="function"?function(){return(d=this.apply(a,arguments))===e?a:d}.bind(d):d;a.init&&a.init.apply(a,arguments)}return f.extend=function(f){d={};for(c in b)d[c]=b[c];for(c in f)d[c]=f[c],b[c]!==e&&(d["__"+c]=b[c]);return a(d)},f},typeof module=="object"&&(module.exports=Model); |
{ | ||
"name": "fishbone", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A super lightweight (½kb) JavaScript library with automatic method chaining, automatic context binding, event support and simple inheritance.", | ||
@@ -5,0 +5,0 @@ "main": "fishbone.js", |
@@ -5,3 +5,3 @@ # Fishbone.js `c-{{{-<` | ||
Version: 1.0.0 | ||
Version: 1.0.1 | ||
@@ -83,10 +83,11 @@ ### Features | ||
```js | ||
Model=function a(b,c,d,e){function f(){var a=this,f={};a.on=function(a,b){(f[a] | ||
||(f[a]=[])).push(b)},a.trigger=function(a,b,d){for(d=f[a],c=0;d&&c<d.length;)d | ||
[c++](b)},a.off=function(a,b){for(d=f[a]||[];b&&(c=d.indexOf(b))>-1;)d.splice(c | ||
Model=function a(b,c,d,e){function f(){var a=this,f={};a.on=function(a,b){(f[a]|| | ||
(f[a]=[])).push(b)},a.trigger=function(a,b){for(var c=f[a],d=0;c&&d<c.length;)c | ||
[d++](b)},a.off=function(a,b){for(d=f[a]||[];b&&(c=d.indexOf(b))>-1;)d.splice(c | ||
,1);f[a]=b?d:[]};for(c in b)d=b[c],a[c]=typeof d=="function"?function(){return( | ||
d=this.apply(a,arguments))===e?a:d}.bind(d):d;a.init&&a.init.apply(a,arguments) | ||
}return f.extend=function(f){d={};for(c in b)d[c]=b[c];for(c in f)d[c]=f[c],b[c | ||
]!==e&&(d["__"+c]=b[c]);return a(d)},f},typeof module=="object"&&( | ||
module.exports=Model); // c-{{{-< | ||
]!==e&&(d["__"+c]=b[c]);return a(d)},f},typeof module=="object"&&(module.exports | ||
=Model); // c-{{{-< | ||
``` | ||
@@ -100,3 +101,9 @@ | ||
### Browser Support | ||
Fishbone runs in all modern browsers and Node.js. | ||
If you want support for Internet Explorer 8 and below, you have to include the | ||
`.bind` and `.indexOf` polyfills: [https://github.com/aemkei/fishbone.js/blob/master/polyfills.js](https://github.com/aemkei/fishbone.js/blob/master/polyfills.js) | ||
### About | ||
@@ -103,0 +110,0 @@ |
12
tests.js
@@ -1,3 +0,7 @@ | ||
var Model = require("./fishbone"); | ||
var isBrowser = typeof window != "undefined"; | ||
if (!isBrowser){ | ||
Model = require("./fishbone"); | ||
} | ||
var tests = { | ||
@@ -289,4 +293,8 @@ "Class based instance property.": function(){ | ||
var log = isBrowser ? function(message){ | ||
document.write(message + "<br>"); | ||
} : console.log; | ||
for (var description in tests){ | ||
console.log(tests[description]() ? "OK" : "ERROR", "-", description); | ||
log((tests[description]() ? "OK" : "ERROR") + " - " + description); | ||
} |
Sorry, the diff of this file is not supported yet
16114
11
347
110