Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Load dependencies first

$
0
0
Hi Justin,

You said that "shim is a much better way of doing it because it sets up the dependency for every page using steal." But if  I create a file XXX using depreciated 'then' with dependency 'A' and if I steal the file XXX I will steal the dependency A too. So this is the same and I do not need to configure the second file 'stealconfig.js' , isn't it ?



Does this code ensure that the function will be run after and only after the dependencies ('jquery','can', 'can/construct/super', './core.js') are  finished?

  1. steal( 'jquery', 'can', 'can/construct/super', './core.js', function($, can, core){
  2.       //some code...
  3. });

Does this code above mean, that the first will be loaded 'jquery', the second will be loaded 'can/construct/super', the third  './core.js' and only
after that the "function", or all dependencies will be loaded in unpredictable order ?

Loading:

  •  'jquery' --> 'can'  -->  'can/construct/super ' --> './core.js'  --> 'function ' 
or 
  •  ( 'jquery' + 'can' +  'can/construct/super' + './core.js' ) --> 'function'
if './core.js' depends on 'jquery' and 'can' and 'can/construct/super' should I use steal in 2 files like this:

'core.js' file:
  1. steal('jquery', 'can',  'can/construct/super', function($, can){
  2.       //some code...
  3. });
'todos.js' file:

  1. steal( './core.js', function(core){
  2.       //some code...
  3. });

is this the same?

  1. steal('jquery', 'core', function($, core){});
as

  1. steal('jquery', 'core').then( function(){});

Viewing all articles
Browse latest Browse all 3491

Trending Articles