diff --git a/README.md b/README.md index db6237f..0c6c033 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Now lets actually use the _Ticker_ Class. First, create the object. and bind our _tick_ event with its data parameter - ticker.bind('tick', function(date) { + ticker.on('tick', function(date) { console.log('notified date', date); }); diff --git a/examples/example.html b/examples/example.html index 09ded2f..d975ba8 100644 --- a/examples/example.html +++ b/examples/example.html @@ -21,7 +21,7 @@ // create a ticker var ticker = new Ticker(); // bind the 'tick' event - ticker.bind('tick', function(date) { + ticker.on('tick', function(date) { // display to check console.log('notified data'+ date); }); diff --git a/examples/example.js b/examples/example.js index 6a9a78a..ef3db7b 100644 --- a/examples/example.js +++ b/examples/example.js @@ -18,7 +18,7 @@ MicroEvent.mixin(Ticker); // create a ticker var ticker = new Ticker(); // bind the 'tick' event -ticker.bind('tick', function(date) { +ticker.on('tick', function(date) { // display to check console.log('notified date', date); }); diff --git a/microevent-debug.js b/microevent-debug.js index 2eb14f3..75422c7 100755 --- a/microevent-debug.js +++ b/microevent-debug.js @@ -6,12 +6,12 @@ var MicroEvent = function(){} MicroEvent.prototype = { - bind : function(event, fct){ + on : function(event, fct){ this._events = this._events || {}; this._events[event] = this._events[event] || []; this._events[event].push(fct); }, - unbind : function(event, fct){ + off : function(event, fct){ console.assert(typeof fct === 'function'); this._events = this._events || {}; if( event in this._events === false ) return; @@ -35,7 +35,7 @@ MicroEvent.prototype = { * @param {Object} the object which will support MicroEvent */ MicroEvent.mixin = function(destObject){ - var props = ['bind', 'unbind', 'trigger']; + var props = ['on', 'off', 'trigger']; for(var i = 0; i < props.length; i ++){ if( typeof destObject === 'function' ){ destObject.prototype[props[i]] = MicroEvent.prototype[props[i]]; diff --git a/microevent.js b/microevent.js index 45ab5d9..af4d227 100755 --- a/microevent.js +++ b/microevent.js @@ -11,12 +11,12 @@ var MicroEvent = function(){}; MicroEvent.prototype = { - bind : function(event, fct){ + on : function(event, fct){ this._events = this._events || {}; this._events[event] = this._events[event] || []; this._events[event].push(fct); }, - unbind : function(event, fct){ + off : function(event, fct){ this._events = this._events || {}; if( event in this._events === false ) return; this._events[event].splice(this._events[event].indexOf(fct), 1); @@ -38,7 +38,7 @@ MicroEvent.prototype = { * @param {Object} the object which will support MicroEvent */ MicroEvent.mixin = function(destObject){ - var props = ['bind', 'unbind', 'trigger']; + var props = ['on', 'off', 'trigger']; for(var i = 0; i < props.length; i ++){ if( typeof destObject === 'function' ){ destObject.prototype[props[i]] = MicroEvent.prototype[props[i]];