Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down
2 changes: 1 addition & 1 deletion examples/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
2 changes: 1 addition & 1 deletion examples/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
6 changes: 3 additions & 3 deletions microevent-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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]];
Expand Down
6 changes: 3 additions & 3 deletions microevent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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]];
Expand Down