简体   繁体   中英

Ext.application: Uncaught TypeError: undefined is not a function

I am having some issues with my extjs 5 application. I am using Sencha Architect and im running the application on FreeBSD.

The error I am getting is Uncaught TypeError: undefined is not a function for 'Ext.application'

Here is my code

// @require @packageOverrides
Ext.Loader.setConfig({

});


Ext.application({
models: [
    'BassSearch',
    'BassSearchResult',
    'Menu',
    'Customer',
    'Subscription',
    'NetInfo',
    'Products',
    'AddressSearch',
    'AddressAll',
    'Interface',
    'Phone'
],
stores: [
    'SearchStore',
    'CustomerStore',
    'NetinfoStore',
    'InterfaceStore',
    'PhoneStore',
    'BassMenuStore',
    'JsonSubscriptions'
],
views: [
    'fSearch',
    'searchResult',
    'SearchPanel',
    'ApplicationPanel',
    'MenuPanel',
    'MainBass',
    'CustomerInfoView'
],
controllers: [
    'searchController',
    'MenuSubController',
    'CustomerInfoController'
],
name: 'MyApp',

launch: function() {
    Ext.create('MyApp.view.MainBass');
    //load
    var myCookieVal = document.cookie.indexOf('basssessionid');
    if (myCookieVal) {
        window.location.href="index.html";
    } else {
        var xhReq = new XMLHttpRequest();
        var request = 'api/checkSession';
        xhReq.open("GET", request, false);
        xhReq.send(null);
        var json = JSON.parse(xhReq.responseText);
        if (!json.success) {
            window.location.href="index.html";
        }
    }
    Ext.define('BASSSharedData', {cid: 0});

    MyApp.globals = {
        currentcid: 0,
        userid: 0,
        callback: "",
        subscriptionid: 0,
        currentView: null
    };


}

});

Any help appriciated.

Thanks

The error usually means that you're calling a function of an object which is not yet initialised (closest resemblance is NullPointerException in JAVA). If xhReq.send(null); is asynchronous or it fails, xhreq.responseText should be null/undefined when you call it in the next statement.

Go through this tutorial to learn about how to use 'XMLHTTPRequest'. If xhReq.responseText isn't the cause, try debugging the code using Chrome or Firefox's Firebug or else put 'alert()' at different places to see where is the source of the cause.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM