Created
May 30, 2018 07:48
-
-
Save infinnie/1a7bcaac1ec31e480b69da71fca3a0e4 to your computer and use it in GitHub Desktop.
Hyperapp eventOptions proposal
This file contains 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
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>); | |
} |
This file contains 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
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