Forked from barneycarroll/mithril.capturingEventHandler.js
Last active
August 29, 2015 14:21
-
-
Save bs1180/b59e2c19fefd8f342b08 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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