Skip to content

Instantly share code, notes, and snippets.

@eridal
eridal / monitorEvents.js
Created November 23, 2016 23:55 — forked from PaulKinlan/monitorEvents.js
monitorEvents.js
function monitorEvents(element) {
var log = function(e) { console.log(e);};
var events = [];
for(var i in element) {
if(i.startsWith("on")) events.push(i.substr(2));
}
events.forEach(function(eventName) {
element.addEventListener(eventName, log);
});
@eridal
eridal / simple.js
Created October 30, 2015 17:11 — forked from paton/simple.js
Super simple implementation of define() and require() used in Localize.js (https://localizejs.com)
var define, require;
(function() {
var modules = {};
require = function(name) {
return modules[name]();
};
define = function(name, fn) {