I have an application compiled in dart2js (Dart SDK version 0.6.13.0_r25630) and I'd like to load it with RequireJS everytime I need.
First of all, thanks God for wrapper function in compiled javascript, but in my case is not enough :(
I use requirejs to load a dart2js application
require(["application.dart"], function () {});
but i would like to handle when to start the application. for example on click event.
require(["jQuery","application.dart"], function (jQuery,$) {
jQuery(element).click(function(){
$.startRootIsolate($.main$closure);
})
});
I hacked the compiled Javascript, but i'd like to know if it's possible in native way.
in application.dart.js I wrapped the function in a AMD module
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as anonymous module.
define([],function(){
return factory();
} );
} else {
// Browser globals.
factory();
}
})(function($) {...})
then I return $ Object
return $;
and finally i commented this line of code where i found
$.startRootIsolate($.main$closure);
Thanks everyone
marco