Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Execute multiple functions where one is expected. Useful for event handling.
function multi(){
var handlers = arguments, function( x ){
return x instanceof Function
} )
return function handle(){
for( var i = 0; i < handlers.length; i++ )
handlers[ i ].apply( this, arguments )

This comment has been minimized.

Copy link

@pelonpelon pelonpelon commented Apr 29, 2015

Use case:

m( 'form', {
    onkeypress : multi(
        onKey( 'enter', ),
        onKey( 'esc',   ctrl.delete )
}, content );

onKey function here


This comment has been minimized.

Copy link

@gilbert gilbert commented Apr 29, 2015

An alternative name for this function is doAll

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.