Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Note

Code Style Conventions can be found here: Code Style Conventions for JavaScript

...

  1. Always create atleast 1 Jasmine-style BDD test for every function
  2. Always create atleast 1 Jasmine-style BDD test for every single control action
  3. Always define a route for every view you create in ST2/ExtJS. Route and view should have the same name.
  4. Enable CORS headers whenever you are doing Ext.Ajax requests:

    Code Block
    Ext.Ajax.request({
        url: HOST + yourRequestURL,
        withCredentials: true,
        useDefaultXhrHeader: false
    });
  5. ...

Recommended:

  1. It is recommended that you use Object literal-style JavaScript class declaration as follows, with a capitalized first-character classname:

    Code Block
    var Foo = {
        type: "fruit",
        color: "red",
        getName: function () {
            return this.color + ' ' + this.type + ' Foo';
        }
    }


  2. It is recommended that you place the .json files for in the data folder in the same level as app folder and index.html (as described in Architecting your App)
  3. It is recommended you name your Jasmine spec files in camelCase
  4. It is recommend that you create an enum for the different pages you can navigate to using "setActiveItem", rather than writing setActiveItem(1). This helps with readability and updateability of the code. 

    Code Block
    // Creating enums in JS: http://stackoverflow.com/questions/287903/enums-in-javascript
    var <Current Namespace>.PAGES = {
        LOGIN_SCREEN : 0,
        CONNECTION_SETTINGS : 1,
        OPTIONS_PANEL : 2
    }

    See how Joy M (Unlicensed) handled this in CHW: https://github.com/jming/Raxa-JSS/blob/f88baa795b560a0972d9e1fc98dcebe5432dc600/src/chw/app/controller/basic.js#L21-28. Note that this code should include the current namespace so as to not conflict with the global namespace.

    See how Piyush Madan (Unlicensed) handled this for Lab: https://github.com/Raxa/Raxa-JSS/blob/master/src/resources/scripts/page_enum.js.


  5. ...

Seldom:

  1. Seldom do z

Never:

  1. Never do w

...