Confirmed users
401
edits
No edit summary |
|||
| Line 41: | Line 41: | ||
== Samples == | == Samples == | ||
In the following sample, | In the following sample, | ||
1. Core is an existing module who blocks the first view | |||
2. ParentModule is an existing module who does not block the first view | |||
=== Sample for the module which does block the first view === | === Sample for the module which does block the first view === | ||
// ftu_loader.js | // ftu_loader.js | ||
| Line 61: | Line 62: | ||
// side_tester.js | // side_tester.js | ||
var SideTester = function() {}; | var SideTester = function() {}; | ||
BaseModule.create( | BaseModule.create(SideTester, { | ||
name: 'SideTester', | name: 'SideTester', | ||
_start: function() { | _start: function() { | ||
| Line 82: | Line 83: | ||
// parent.js | // parent.js | ||
ParentModule.prototype.start = function() { | ParentModule.prototype.start = function() { | ||
return Service.request('schedule', () => { | return Service.request('schedule', () => { // This is exactly what BaseModule.prototype.loadWhenIdle does | ||
return LazyLoader.load('child_module.js'); | return LazyLoader.load('child_module.js'); | ||
}).then(() => { | }).then(() => { | ||