Skip to content

Instantly share code, notes, and snippets.

@infinnie
Created May 30, 2018 07:48
Show Gist options
  • Save infinnie/1a7bcaac1ec31e480b69da71fca3a0e4 to your computer and use it in GitHub Desktop.
Save infinnie/1a7bcaac1ec31e480b69da71fca3a0e4 to your computer and use it in GitHub Desktop.
Hyperapp eventOptions proposal
import { EventOptions } from "hyperapp-event-options"; // assuming there existed something like that
export function Component(props) {
return (<button on={{
click: [
props.doSomething,
EventOptions.preventDefault | EventOptions.stopPropagation | EventOptions.hookDocument | EventOptions.capture
]
}}>Button content</button>);
}
export const enum EventOptions {
preventDefault = 1,
stopPropagation = 2,
hookDocument = 4,
hookWindow = 8,
capture = 16
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment