event-pubsub/params.json
2014-03-01 03:39:55 -08:00

1 line
No EOL
3.4 KiB
JSON

{"name":"Event-pubsub","tagline":"Event Pubsub for Javascript will work in node js or browser","body":"Event PubSub\r\n============\r\n\r\nPubsub events for Node and the browser allowing event scoping and multiple scopes. \r\nEasy for any developer level. No frills, just high speed pubsub events!\r\n\r\n[Pretty GitHub.io site](http://riaevangelist.github.io/event-pubsub/) \r\n\r\n[![alt event-pubsub npm details](https://nodei.co/npm/event-pubsub.png?stars=true \"event-pubsub npm package details\")](https://npmjs.org/package/event-pubsub)\r\n\r\n**EXAMPLE FILES** \r\n\r\n1. [Node Pubsub Event Examples](https://github.com/RIAEvangelist/event-pubsub/tree/master/examples/node) \r\n2. [Browser Pubsub Event Examples](https://github.com/RIAEvangelist/event-pubsub/tree/master/examples/browser)\r\n\r\n**Node Install** \r\n``npm install event-pubsub``\r\n\r\n**Browser Install** \r\n*see browser examples above or below*\r\n\r\n---\r\n### Basic Example\r\n---\r\n***NOTE - the only diffeence between node and browser code is how the ``events`` variable is created*** \r\n* node ``var events = new require('../../event-pubsub.js')();``\r\n* browser ``var events = new window.pubsub();``\r\n\r\n#### Node\r\n\r\n var events = new require('../../event-pubsub.js')();\r\n\r\n events.on(\r\n 'hello',\r\n function(data){\r\n console.log('hello event recieved ', data);\r\n }\r\n );\r\n \r\n events.on(\r\n '*',\r\n function(type){\r\n console.log('Catch all detected event type of : ',type, '. List of all the sent arguments ',arguments);\r\n }\r\n );\r\n \r\n events.on(\r\n 'removeEvents',\r\n function(){\r\n events.off('*');\r\n console.log('Removed all events');\r\n }\r\n );\r\n \r\n /************************************\\\r\n * trigger events for testing\r\n * **********************************/\r\n events.trigger(\r\n 'hello',\r\n 'world'\r\n );\r\n \r\n events.trigger(\r\n 'removeEvents'\r\n );\r\n \r\n\r\n#### Browser\r\n##### HTML\r\n\r\n <!DOCTYPE html>\r\n <html>\r\n <head>\r\n <title>PubSub Example</title>\r\n <script src='../../event-pubsub-browser.js'></script>\r\n <script src='yourAmazingCode.js'></script>\r\n </head>\r\n <body>\r\n ...\r\n </body>\r\n </html>\r\n\r\n##### Inside Your Amazing Code\r\n\r\n var events = new window.pubsub();\r\n\r\n events.on(\r\n 'hello',\r\n function(data){\r\n console.log('hello event recieved ', data);\r\n }\r\n );\r\n \r\n events.on(\r\n '*',\r\n function(type){\r\n console.log('Catch all detected event type of : ',type, '. List of all the sent arguments ',arguments);\r\n }\r\n );\r\n \r\n events.on(\r\n 'removeEvents',\r\n function(){\r\n events.off('*');\r\n console.log('Removed all events');\r\n }\r\n );\r\n \r\n /************************************\\\r\n * trigger events for testing\r\n * **********************************/\r\n events.trigger(\r\n 'hello',\r\n 'world'\r\n );\r\n \r\n events.trigger(\r\n 'removeEvents'\r\n );\r\n","google":"UA-48524110-2","note":"Don't delete this file! It's used internally to help with page regeneration."}