Speedometer 2.0: Flight.js test is sometime broken
[WebKit-https.git] / PerformanceTests / Speedometer / resources / todomvc / dependency-examples / flight / flight / app / js / main.js
1 /*global DEBUG */
2 'use strict';
3
4 require.config({
5     baseUrl: './',
6     paths: {
7         jquery: 'node_modules/jquery/dist/jquery',
8         es5shim: 'node_modules/es5-shim/es5-shim',
9         es5sham: 'node_modules/es5-shim/es5-sham',
10         text: 'node_modules/requirejs-text/text',
11         flight: 'node_modules/flight',
12         depot: 'node_modules/depot/depot',
13         memorystorage: 'node_modules/memorystorage/memorystorage',
14         app: 'app/js',
15         templates: 'app/templates',
16         ui: 'app/js/ui',
17         data: 'app/js/data',
18     },
19     shim: {
20         'app/page/app': {
21             deps: ['jquery', 'es5shim', 'es5sham']
22         }
23     }
24 });
25
26 function checkReady(count) {
27     if (window.checkLoadedTimeoutId)
28         return setTimeout(checkReady.bind(this, 0), 50);
29     if (count < 5)
30         return setTimeout(checkReady.bind(this, count + 1), 10);
31
32     var dummyNodeToNotifyAppIsReady = document.createElement('div');
33     dummyNodeToNotifyAppIsReady.id = 'appIsReady';
34     document.body.appendChild(dummyNodeToNotifyAppIsReady);
35 }
36
37 require([], function () {
38     require(['app/page/app'],function(App){
39         App.initialize();
40         checkReady(0);
41     });
42 });