Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bs1180/b59e2c19fefd8f342b08 to your computer and use it in GitHub Desktop.
Save bs1180/b59e2c19fefd8f342b08 to your computer and use it in GitHub Desktop.
// Event capturing for Mithril.js
// Demo here: http://jsfiddle.net/barney/vsw8r3Lh/
m.capture = function capturingEventHandler( eventName, handler ){
function bindCapturingHandler( element ){
element.addEventListener( eventName, handler, true );
}
return function config( element, init ){
if( !init ) bindCapturingHandler( element );
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment