Skip to content

Instantly share code, notes, and snippets.

@ggirou
Last active December 22, 2015 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ggirou/6543763 to your computer and use it in GitHub Desktop.
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
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);
}
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