Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
An object event injection.
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
History.md
Makefile
README.md
component.json
index.js
package.json
start.json

README.md

eventy

An object event injection.

Installation

npm

npm install eventy

component

component install shallker-wang/eventy

Quick Start

var eventy = require('eventy');

function onUpdate(value) {
  console.log(value);
}

var user = {}
eventy(user);
user.on('update', onUpdate);
user.trigger('update', 'dead');
user.off('update', onUpdate);

Global Uses

var Eventy = require('eventy');

var Events = new Eventy();

function me() {
  Events.on('hi', function(message) {
    console.log(message);
  })  
}

function you() {
  Events.trigger('hi', 'from you');
}

me();
you();

API

eventy

.on(String eventname, Function callback)

.off(String eventname, Function callback)

.trigger(String eventname, [Arguments args...])

.triggerSync(String eventname, [Arguments args...])

Test

Browser side
http://shallker-wang.github.io/eventy/test/index.html
http://shallker-wang.github.io/eventy/test/pass-args.html
http://shallker-wang.github.io/eventy/test/multi-callbacks.html


Copyright (c) 2013 Shallker Wang - MIT License (enclosed)

Something went wrong with that request. Please try again.