Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Emitter.prototype.on = function (event, listener)
- {
- if (typeof this.events[event] !== 'object')
- {
- this.events[event] = [];
- }
- this.events[event].push(listener);
- };
- describe('#on', () =>
- {
- it('should subscribe to an event name and be called when
- triggered', () =>
- {
- Emitter.on(EVENT_NAME_ONE, spyFunction);
- //Emitter.trigger(EVENT_NAME_ONE);
- expect(spyFunction.calls.count()).toBe(1);
- });
Add Comment
Please, Sign In to add comment