1. #1
    Sencha Premium Member
    Join Date
    Mar 2013
    Location
    Driebergen, The Netherlands
    Posts
    71
    Answers
    6
    Vote Rating
    3
    MartineNavara is on a distinguished road

      0  

    Default Answered: Custom Proxy and build

    Answered: Custom Proxy and build


    I am using a custom proxy in my app. Without building the app, I can use the proxy without any problems.
    The proxy is called in a model:
    Code:
    proxy: new Navara.proxy.NavaraProxy({
                navaraCollection: 'collectionName',
                uniqueIdStrategy: true
            })
    And the only reference to the proxy is in app.json:
    Code:
        "js": [
            // ...
            {
                "path": "resources/navara/proxy/NavaraProxy.js"
            },
            // ...
        ],
    This is working fine before any build (testing / production). After a build, I get the exception 'Navara is not defined'.

    If figured out I should add the file as a require to my app to load. I did try this, but when running build in cmd it isn't able to solve the dependency (Failed to find any files .. ClassRequire: Navara.proxy.NavaraProxy).

    I added the following code to app.js:
    Code:
    Ext.Loader.setPath({
        //...
        'Navara': 'resources/navara'
       //...
    });
    Code:
       requires: [
            'Navara.proxy.NavaraProxy'
        ],
    I also tried to move this code to one of my models, but it doesn't solve my problem.

    What am I doing wrong?


    The structure of NavaraProxy:
    Code:
    // Navara API Singleton
    Ext.define('Navara.proxy', {
        singleton: true,
    
    
        _api: null,    
        api: function() {
            if (!this._api) {
                this._api = new navara.Data;
                this._api.allowDataTransfer(true);
            }
            return this._api;
    
        } 
    });
    
    
    
    
    Ext.define('Navara.proxy.NavaraProxy', {
        extend: 'Ext.data.proxy.Proxy',
        alias: 'proxy.NavaraProxy',
    
    
        requires : ['Navara.proxy'],
    
    
        // config which implements CRUD
    });

  2. I solved my problem by adding the api.js in index.html

  3. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Answers
    102
    Vote Rating
    79
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    try switching out:
    new Navara.proxy.NavaraProxy

    to Ext.create('Navara.proxy.NavaraProxy'

    and do a build, see if that resolves it.

  4. #3
    Sencha Premium Member
    Join Date
    Mar 2013
    Location
    Driebergen, The Netherlands
    Posts
    71
    Answers
    6
    Vote Rating
    3
    MartineNavara is on a distinguished road

      0  

    Default


    Thank you for your reply.
    It doesn't solve my problem though. When I replace new with Ext.create, and don't add Navara.proxy.NavaraProxy to requires anywhere, it still works fine before a build.
    After a build it doesn't know Navara (referenceError), and doesn't work.

    I tried to add Navara.proxy.NavaraProxy as an requires to a model, but as explained above Sencha CMD isn't able to solve this requirement on build. How can I add the proxy in the right way as an requirement?

  5. #4
    Sencha Premium Member
    Join Date
    Mar 2013
    Location
    Driebergen, The Netherlands
    Posts
    71
    Answers
    6
    Vote Rating
    3
    MartineNavara is on a distinguished road

      0  

    Default


    I generated a new app with cmd and added the proxy. I discovered the problem isn't the proxy, but loading the API.

    In Navara.proxy I do need the API:
    Code:
    Ext.define('Navara.proxy', {
        singleton: true,
        _api: null,
    
        api : function() {
            if (!this._api){
                this._api = new navara.Data;
                this._api.allowDataTransfer(true);
            }
        }
    });
    When building the app (testing), I now get the following error:
    'Uncaught ReferenceError: navara is not defined'

    navara is part of the API. How do I make sure the API is correctly added to my app?
    I have added the API in the app.json file:
    Code:
        "js": [
            {
                "path": "touch/sencha-touch-debug.js",
                "x-bootstrap": true
            },
            {
                "path": "app.js",
                "bundle": true,
                "update": "delta"
            },
            {
                "path": "resources/navara/NavaraAPI.js"
            }
        ],

  6. #5
    Sencha Premium Member
    Join Date
    Mar 2013
    Location
    Driebergen, The Netherlands
    Posts
    71
    Answers
    6
    Vote Rating
    3
    MartineNavara is on a distinguished road

      0  

    Default


    I solved my problem by adding the api.js in index.html

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi