Created
August 22, 2014 14:37
-
-
Save barneycarroll/16cdf52722f6addbdcd9 to your computer and use it in GitHub Desktop.
Event capturing in Mithril.js
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
something wrong with the jsfiddle