rtc-glue
Version:
A simple library for writing WebRTC applications an in HTML-centric way
32 lines (24 loc) • 786 B
JavaScript
/* jshint node: true */
;
var eve = require('eve');
var rePrefixed = /^glue\./;
/**
## Events
Glue uses [eve](https://github.com/adobe-webplatform/eve) under the hood,
and exposes a simple interface to eve events through the `glue.events`
interface.
If using eve directly these events are namespaced with the prefix of
`glue.` to avoid event name clashes on the bus, but you can use the
`glue.events` endpoint to attach to eve without the namespace if you prefer.
For example:
<<< examples/event-namespacing.js
**/
['on', 'once', 'off'].forEach(function(method) {
exports[method] = function(name, handler) {
if (! rePrefixed.test(name)) {
name = 'glue.' + name;
}
// register the handler
eve[method](name, handler);
};
});