Permalink
Browse files

update Makefile and example to dart2js.

  • Loading branch information...
akrennmair committed Jun 27, 2012
1 parent a7125ee commit c8e8b81023306c7889bcd3c6d11dbcc8d358a923
Showing with 19 additions and 22 deletions.
  1. +2 −2 Makefile
  2. +17 −20 example.dart
View
@@ -4,8 +4,8 @@ JS_SRC=$(DART_SRC).js
all: $(JS_SRC)
$(JS_SRC): $(DART_SRC) hashroute.dart
- $$DART_SDK/bin/frogc --enable-type-checks $< || ( $(RM) $@ && exit 1 )
- yui-compressor --line-break 120 -o $@ $@ || true
+ $$DART_SDK/bin/dart2js --out=$@ $< || ( $(RM) $@ && exit 1 )
+ #yui-compressor --line-break 120 -o $@ $@ || true
clean:
$(RM) $(JS_SRC)
View
@@ -2,27 +2,24 @@
#import('hashroute.dart');
void main() {
- window.on.contentLoaded.add( (e) {
- HashRouter router = new HashRouter();
- router.addHandlerFunc("/foo", (p, v) => window.alert('called /foo'));
- router.addHandlerFunc('/bar/:id', (p, v) => window.alert('called bar (id = ${v["id"]})'));
- router.addHandlerFunc('/baz=:id/:foo', (p, v) => window.alert('called baz = ${v["id"]} foo = ${v["foo"]} complete path: ${p}'));
- router.addHandlerFunc('/', (p, v) => window.alert('catch-all handler: ${p}'));
+ HashRouter router = new HashRouter();
+ router.addHandlerFunc("/foo", (p, v) => print('called /foo'));
+ router.addHandlerFunc('/bar/:id', (p, v) => print('called bar (id = ${v["id"]})'));
+ router.addHandlerFunc('/baz=:id/:foo', (p, v) => print('called baz = ${v["id"]} foo = ${v["foo"]} complete path: ${p}'));
+ router.addHandlerFunc('/', (p, v) => print('catch-all handler: ${p}'));
- document.query('#btn1').on.click.add( (event) {
- event.preventDefault();
- router.goTo("/foo");
- });
- document.query('#btn2').on.click.add( (event) {
- event.preventDefault();
- router.goTo("/bar/23");
- });
- document.query('#btn3').on.click.add( (event) {
- event.preventDefault();
- router.goTo('/baz=42/9001/foo');
- });
-
- router.run();
+ document.query('#btn1').on.click.add( (event) {
+ event.preventDefault();
+ router.goTo("/foo");
+ });
+ document.query('#btn2').on.click.add( (event) {
+ event.preventDefault();
+ router.goTo("/bar/23");
+ });
+ document.query('#btn3').on.click.add( (event) {
+ event.preventDefault();
+ router.goTo('/baz=42/9001/foo');
});
+ router.run();
}

0 comments on commit c8e8b81

Please sign in to comment.