multi-event
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "multi-event", | ||
"version": "1.1.0", | ||
"description": "", | ||
"version": "1.1.1", | ||
"description": "Simple event emitter that supports triggering listener to multiple events", | ||
"main": "dist/multi-event.js", | ||
@@ -23,3 +23,3 @@ "dependencies": {}, | ||
"type": "git", | ||
"url": "https://github.com/yousfiSaad/multi-event.git" | ||
"url": "git+https://github.com/yousfiSaad/multi-event.git" | ||
}, | ||
@@ -36,3 +36,7 @@ "keywords": [ | ||
], | ||
"author": "Saad Y <yousfi.saad@gmail.com> (https://github.com/yousfiSaad/)", | ||
"author": { | ||
"name": "Saad Y", | ||
"email": "yousfi.saad@gmail.com", | ||
"url": "https://github.com/yousfiSaad/" | ||
}, | ||
"license": "MIT", | ||
@@ -42,3 +46,10 @@ "bugs": { | ||
}, | ||
"homepage": "https://github.com/yousfiSaad/multi-event" | ||
"homepage": "https://github.com/yousfiSaad/multi-event", | ||
"readme": "[![Build Status](https://travis-ci.org/yousfiSaad/multi-event.svg?branch=master)](https://travis-ci.org/yousfiSaad/multi-event)\r\n\r\n# Installation\r\n- **Node.js, browserify** `npm install multi-event --save`\r\n- **Require.js** `require([\"multi-event\"], ...`\r\n\r\n# Examples\r\n\r\n```javascript\r\nvar MultiEvent = require('multi-event'); // require it\r\nvar myEvents = new MultiEvent();\r\n\r\n// Implement listener\r\nvar callBack = function (arg) {\r\n console.log(arg);\r\n};\r\n\r\n// Register callBack event listener\r\nmyEvents.on('event', callBack);\r\n\r\nmyEvents.emit('event', 'this will be passed to the callback');\r\n// shows 'this will be passed to the callback' in console\r\n```\r\n\r\n# Multiple events Examples\r\n\r\n```javascript\r\nvar MultiEvent = require('multi-event'); // require it\r\nvar myEvents = new MultiEvent();\r\nvar myEventsSubSet = new MultiEvent();\r\n\r\nmyEvents.pipe(\"event2.*\", myEventsSubSet);\r\n\r\n// Implement listener\r\nvar callBack1 = function (arg) {\r\n console.log('callBack1 says : '+ arg);\r\n};\r\nvar callBack2 = function (arg) {\r\n console.log('callBack2 says : '+ arg);\r\n};\r\n\r\nvar callBack = function (arg) {\r\n console.log('callBack says : '+ arg);\r\n};\r\n\r\nvar pipeCallBack = function (arg) {\r\n console.log('pipeCallBack says : '+ arg + ' (from myEventsSubSet)');\r\n};\r\n\r\n\r\n// Register callBack event listener\r\nmyEvents.on('event.subevent1', callBack1)\r\n .on('event.subevent2', callBack2)\r\n .on('event.*', callBack); // this callBack is trigged to all 'event' sub-events\r\n \r\nmyEventsSubSet.on(\"event2.eventViaPipe\", pipeCallBack);\r\n\r\nmyEvents.emit('event.subevent1', 'this string will be logged twice');\r\n// the following will be displayed on the console\r\n// callBack1 says : this string will be logged twice\r\n// callBack says : this string will be logged twice\r\nmyEvents.emit('event.subevent2', 'this string will be logged twice');\r\n// the following will be displayed on the console\r\n// callBack2 says : this string will be logged twice\r\n// callBack says : this string will be logged twice\r\n\r\nmyEvents.emit('event2.eventViaPipe', 'this will be passed to the other emitter also');\r\n// the following will be displayed on the console\r\n// pipeCallBack says : this will be passed to the other emitter also (from myEventsSubSet)\r\n```\r\n\r\n# EcmaScript6\r\nThis module is writen in ES6, you can find the in `src/multi-event-es6.js`\r\n\r\nFor building your modification run `npm run build`, the files `multi-event.js` and `multi-event.min.js` are created in `dist` folder\r\n\r\n## Build and test\r\n\r\n- **Build** `npm run build`\r\n- **Test** `npm run test`\r\n- **Watch changes and run tests and buil** `npm run watch`\r\n\r\n", | ||
"readmeFilename": "README.md", | ||
"gitHead": "967e09ceb1d3452a924e358911a6f5c991bb0d32", | ||
"_id": "multi-event@1.1.0", | ||
"_shasum": "92cf60bf5e12a768b0aeed9b55099c7f1ea5be49", | ||
"_from": "multi-event", | ||
"_resolved": "file:multi-event" | ||
} |
27360