Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>So the key to this issue is changes in underscore.js. Specifically the fact it now supports AMD (Asynchronous Module Definition). The fact that underscore no longer attaches itself to the global namespace when require is detected is breaking the scheme used to allow a standard asynchronous require syntax but still maintain synchronous loading.</p> <p>Now that JQuery, Underscore &amp; Backbone (0.5.3 does not register itself, you need <a href="https://github.com/documentcloud/backbone/pull/710" rel="noreferrer">a this</a>) support async loading, you are able to abandon those hacked libraries in favor of the standard ones and require the names those libraries register themselves with. Like this:</p> <p><em><strong>Main.js</em></strong></p> <pre><code>require.config({ baseUrl: "js", paths: { jquery: "libs/jquery/jquery", underscore: "libs/underscore/underscore", backbone: "libs/backbone/backbone" }, waitSeconds: 10 }); require([ "app" ], function(App){ App.initialize(); console.log("Main initialized..."); }); </code></pre> <p><em><strong>index.js</em></strong></p> <pre><code>define([ "jquery", "underscore", "backbone" ], function($, _, Backbone){ console.log(_); console.log(Backbone); var IndexView = Backbone.View.extend({ render: function(){ var username = getCookie("username"); var data = {username: username}; var compiled = _.template("&lt;h1&gt;Welcome &lt;%= username %&gt;&lt;/h1&gt;", data); $(this.el).html(compiled); $("#lt-col").html(this.el); } }); return new IndexView(); }); </code></pre> <p>Other define's were changed to reflect the new lowercase alias's.</p> <p>Pull the fixed code <a href="http://www.markfalto.com/Examples/sampleFixed.zip" rel="noreferrer">here</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload