javascript - requirejs dependency ordering -


given following requirejs definitions on page:

<script type="text/javascript">     require(['path/to/scripta']);     require(['path/to/scriptb']);         </script> 

question 1: without assuming dependencies between scripta , scriptb, requirejs guaranteed load scripta prior scriptb?

question 2: assume scripta internally defines scriptb dependency. e.g.:

// scripta: define(['path/to/scriptb'], function(scriptb) {.... 

is scriptb guaranteed load prior prior scripta regardless of ordering of initial require(..) definitions? since scripta defines scriptb dependency, should remove require(..) call scriptb <script> tag?

both scripts should load in parallel. regarding execution order, following should true:

question 1: no, without explicitly defining dependencies, scripta not guaranteed execute before scriptb.

question 2: yes, explicitly defining scriptb dependency of scripta, execute first. considering this, can indeed remove scriptb original script tag.

hope helps


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -