Skip to content

Instantly share code, notes, and snippets.

@eduardo-matos
Created May 6, 2013 16:24
Show Gist options
  • Save eduardo-matos/5526204 to your computer and use it in GitHub Desktop.
Save eduardo-matos/5526204 to your computer and use it in GitHub Desktop.
Emiting custom events on plain object.
require([
'dojo/on',
'dojo/Evented',
'dojo/_base/lang'
], function (
on,
Evented,
lang
) {
'use strict';
var plainObject = {
foo: 'bar'
};
lang.mixin(plainObject, Evented.prototype);
on(plainObject, 'some-custom-event', function () {
console.log('Event!')
});
on.emit(plainObject, 'some-custom-event');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment