Created
November 7, 2017 17:16
-
-
Save thosakwe/f87c2cdaa32ebccc4e316d67019281d7 to your computer and use it in GitHub Desktop.
Example of Dart HTML5 usage
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
| import 'dart:html'; | |
| final ButtonElement $button = querySelector('#button'); | |
| final Iterable<AnchorElement> $links = querySelectorAll('a:not(.active)'); | |
| void main() { | |
| $button.onClick.listen((_) { | |
| window.alert('Hello, world!'); | |
| }); | |
| $links.forEach(($link) { | |
| $link.onClick.listen((Event e) { | |
| e.preventDefault(); | |
| window.console.info('Clicked ${$link.attributes['href']}'); | |
| }); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment