Commit a4bdbf28 authored by Ivan Tyagov's avatar Ivan Tyagov

Fix module load order and use proper gadget bindReady event.

parent 3940f9c7
...@@ -4,21 +4,19 @@ require.config({ ...@@ -4,21 +4,19 @@ require.config({
paths: { paths: {
route: "lib/route/route", route: "lib/route/route",
url: "lib/route/url", url: "lib/route/url",
jquery: "lib/jquery/jquery" jquery: "lib/jquery/jquery",
renderjs: "renderjs",
}, },
shim: {
url: [ "renderjs" ]
}
}); });
require([ "require-renderjs", "jquery", "route", "url" ], function(domReady) { require([ "renderjs", "require-renderjs", "jquery", "route", "url" ], function(domReady) {
var body = $("body"); RenderJs.bindReady(function (){
// XXX: we should use Renderjs's bindReady var body = $("body");
setTimeout( RenderJs.GadgetIndex.getGadgetById("gadget-color-picker").render();
function () { $.url.onhashchange(function () {
// render color picker application
RenderJs.GadgetIndex.getGadgetById("gadget-color-picker").render();
// Trigger route change
$.url.onhashchange(function () {
body body
.route("go", $.url.getPath()) .route("go", $.url.getPath())
.fail(function () { .fail(function () {
...@@ -32,6 +30,6 @@ require([ "require-renderjs", "jquery", "route", "url" ], function(domReady) { ...@@ -32,6 +30,6 @@ require([ "require-renderjs", "jquery", "route", "url" ], function(domReady) {
//initialize_route.apply(this, []); //initialize_route.apply(this, []);
RenderJs.GadgetIndex.getGadgetById("gadget-color-picker").render(); RenderJs.GadgetIndex.getGadgetById("gadget-color-picker").render();
}); });
}); });
}, 1000); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment