Skip to content

Instantly share code, notes, and snippets.

@thosakwe
Created November 7, 2017 17:16
Show Gist options
  • Select an option

  • Save thosakwe/f87c2cdaa32ebccc4e316d67019281d7 to your computer and use it in GitHub Desktop.

Select an option

Save thosakwe/f87c2cdaa32ebccc4e316d67019281d7 to your computer and use it in GitHub Desktop.
Example of Dart HTML5 usage
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