Last active
December 22, 2015 22:59
-
-
Save ggirou/6543763 to your computer and use it in GitHub Desktop.
Dynamically load code with Dart thanks to spawnUri
http://blog.sethladd.com/2013/04/dynamically-load-code-with-dart.html
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 'dart:html'; | |
import 'dart:isolate'; | |
SendPort reverser; | |
void main() { | |
reverser = spawnUri("https://gist.github.com/ggirou/6543763/raw/5be58e6aa28096e1e0f088112a59cbd2baab7719/test.dart"); | |
// reverser = spawnUri("test.dart"); | |
query('#button').onClick.listen(test); | |
} | |
test(_) { | |
reverser.call("").then(print); | |
} |
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 'dart:isolate'; | |
void main() { | |
port.receive((msg, SendPort replyTo) { | |
replyTo.send("Hello world!"); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment