Skip to content

Instantly share code, notes, and snippets.

@danielrw7
danielrw7 / event-framework.js
Created June 21, 2015 22:31
Simple event triggering/handling framework
function hasProperty(obj, prop) {
return obj[prop] !== undefined;
};
Array.prototype.callFunction = function(target, key) {
var args = [].splice.call(arguments, 0).slice(2);
this.forEach(function(elem) {
try {
if (hasProperty(elem, key) && typeof elem[key] == 'function') {