Note that there are some explanatory texts on larger screens.

plurals
  1. POrequire.js, backbone and cordova issue
    text
    copied!<p>I have a problem when using apache cordova version 2.7. In the browser the code seems to work fine as i run it from xampp. but when I try to compile to IOS it just doesn't work.</p> <p>I think the issue might be related to the require.js text plugin which is used to load handlebars templates and html files because of the file protocol restrictions on loading files.</p> <p>I also think it might be something related to not listening for device ready event but I'm not sure how to do it correctly in this setting.</p> <p>Our main.js code is:</p> <pre><code>require.config({ shim: { underscore: { exports: '_' }, backbone: { deps: ['underscore', 'jquery'], exports: 'Backbone' }, handlebars: { exports: 'Handlebars' }, flipBook: { deps: ['jquery'] }, touchSlider: { deps: ['jquery'] } }, paths: { jquery: 'libs/jquery', jquerymobile: 'libs/jquery.mobile', underscore: 'libs/underscore', backbone: 'libs/backbone', handlebars: 'libs/handlebars', cordovaios: 'libs/cordova-2.7.0', text: 'libs/text', flipBook: 'plugins/flipbook.min', touchSlider: 'plugins/jquery.touchSlider.min' } }); // Includes File Dependencies require(["cordovaios", "jquery", "backbone", "routers/router"], function( cordova, $, Backbone, Router) { // Set up the "mobileinit" handler before requiring jQuery Mobile's module $(document).on("mobileinit", function() { window.App = { Models: {}, Collections: {}, Views: {}, Routers: {} }; $.mobile.linkBindingEnabled = false; $.mobile.hashListeningEnabled = false; $(document).on('pagehide', 'div[data-role="page"]', function(event, ui) { $(event.currentTarget).remove(); }); $(document).on('pagebeforeshow', 'div[data-role="page"]', function () { $.mobile.showPageLoadingMsg(); }); $(document).on('pageshow', 'div[data-role="page"]', function () { $.mobile.hidePageLoadingMsg(); }); document.addEventListener('touchmove', function (e) { e.preventDefault(); }); }); require(["jquerymobile"], function () { // Instantiates a new Backbone.js Mobile Router new Router(); }); }); </code></pre>
 

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