JQuery and NWJS Packaging
$("#main").html("Added using jquery") <div id="main" class="container-fluid">
<p>Default html text</p>
</div><!-- container-fluid -->Uncaught ReferenceError: $ is not definedJQuery
Last updated
$("#main").html("Added using jquery") <div id="main" class="container-fluid">
<p>Default html text</p>
</div><!-- container-fluid -->Uncaught ReferenceError: $ is not definedLast updated
//loads scripts dynamically adding them to the body of the page
function loadExtScript(src, callback) {
var s = document.createElement('script');
s.src = src;
document.body.appendChild(s);
s.onload = function () {
// if loaded...call the callback
if(callback){callback(s)}
}
}
/**
* To make sure scripts are deployed int he right order when NWJS is packaged, a little bit of callbacl hell.
*/
loadExtScript("vendor/jquery.min.js",function(script){
//set jquery for bootstrap
window.jQuery = window.$ ;
loadExtScript("vendor/bootstrap-3.3.6-dist/js/bootstrap.js",function(){
loadExtScript("vendor/underscore-min.js",function(){
loadExtScript("vendor/backbone-min.js",function(){
//app.js backbone files
loadExtScript("js/models/transcription.js",function(){
loadExtScript("js/collections/transcriptions.js",function(){
loadExtScript("js/views/transcription_index.js",function(){
loadExtScript("js/views/transcription_show.js",function(){
loadExtScript("js/views/transcription_form.js",function(){
loadExtScript("js/router.js",function(){
console.log("loaded stuff")
})
})
})
})
})
})
})
})
})
})