0

我正在通过backbone.js 和phonegap 开发一个应用程序,并且在eclipse 的logcat 控制台中出现这个错误:

android.webkit.CallbackProxy 711<!> Uncaught Error: Backbone.history has already been  
started at file:///android_asset/www/libs/backbone/backbone%201.0.0.js:1363

错误指示的代码是加载程序调用的主干库。

这是对 Backbone.history 的显式调用的 main.js:

require.config({
paths: {
    jQuery: '../libs/jquery/jquery-loader',
    jQueryMobile: '../libs/jquery.mobile/jquery.mobile-loader',
    underscore: '../libs/underscore/underscore-loader',
    Backbone: '../libs/backbone/backbone-loader',<--error indicate this library
    order: '../libs/require/order-1.0.5',
    text: '../libs/require/text-1.0.6',
    async: '../libs/require/async',
    PhoneGap: '../libs/phonegap/phonegap-loader',
    Handlebars: '../libs/handlebars/Handlebars',
    templates: '../templates'
}
});

require(['order!jQuery'], function($) {


require(['underscore', 'Backbone', 'router'], function(_, Backbone, AppRouter) {



    document.addEventListener("deviceready", run, false);
     run();

    function run() {

        var sync = Backbone.sync;
    Backbone.sync = function(method, model, options) {
    options.beforeSend = function (xhr) {
    xhr.setRequestHeader('X-Parse-Application-Id',    
    '***S3VMk');
    xhr.setRequestHeader('X-Parse-REST-API-Key', '**fIt1Gm');
    };



    sync(method, model, options);

    },


         Parse.$ = jQuery;


    Parse.initialize("***iTS3VMk",
               "***9qLN7Duy");





        app = new AppRouter();
        console.log("history");
        Backbone.history.start();<--explicit call



       }
  });
  });

骨干装载机:

define(['../libs/backbone/backbone 1.0.0'],
function () {
    return Backbone.noConflict();
});
4

0 回答 0