emit.esl 522 B

123456789101112131415
  1. (lambda emit (event)
  2. (if (! (instanceof event Function)) (block
  3. (console.error "won't be able to emit" event "(not a function)")
  4. (return (lambda ()
  5. (console.error "can't emit" event "(not a function)")))))
  6. (var args1 (Array.prototype.slice.call arguments 1))
  7. (if event.name (Object.define-property emit-event
  8. "name" (object "name" event.name)))
  9. (return emit-event)
  10. (function emit-event ()
  11. (var args2 (Array.prototype.slice.call arguments 0))
  12. (event.apply null (args1.concat args2))))