iceflow-server
Advanced tools
Comparing version 0.1.8 to 0.1.9
const EventEmitter = require('events'); | ||
module.exports = new EventEmitter(); | ||
const Emitter = new EventEmitter(); | ||
const utils = require('../utils/utils') | ||
Emitter._on = Emitter.on; | ||
// @method on | ||
// @description a wrapper for the on method of the EventEmitter instance | ||
// this is important because if multiple components register events on the server | ||
// this can add up to thousands of listeners ultimately causing memory leaks | ||
// the iso param is a requirement for server events (which generally never need to be bound) | ||
// @params | ||
// -evt [String] the event to listen for | ||
// -callback [Function] the callback to call | ||
// -iso [Boolean] If true will bind it on the server as well as client | ||
Emitter.on = function(evt, callback, iso){ | ||
if(!iso && iso !== false && !utils.env.isServer() || iso){ | ||
Emitter._on(evt, callback); | ||
} | ||
} | ||
module.exports = Emitter; |
@@ -66,3 +66,3 @@ { | ||
}, | ||
"version": "0.1.8" | ||
"version": "0.1.9" | ||
} |
@@ -266,3 +266,3 @@ #Iceflow Server | ||
The Events module is the central event aggregator for your app. It's just an alias for node/events. There are a few built in events used for routing. These events are intended for the client only. | ||
The Events module is the central event aggregator for your app. It's just an alias for node/events. The "on" method of Events is a wrapper for the native method, this method by default will not add events on the server to prevent memory leaks. If you need to add events on the server set a third argument as true for "on". There are a few built in events used for routing. These events are intended for the client only. | ||
@@ -269,0 +269,0 @@ route - This will trigger the router to route to the passed in url |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48738
28
1134