Skip to content

TheM.companies Reference

Constructor

The parent TheM class contains functionality enabling the initialization of any TheM subclass or submodule instance by simply calling TheM.doInit('subclassName'), where the input string is a case sensitive space-delimited string containing the names of all submodules that may be required in the current session. Most TheM subclasses also require the 'common' submodule. It is common to initialize the target submodule and any other submodule dependencies concurrently. The following example will initialize a new instance of the necessary submodules using a proxy constructor in TheM parent class.

TheM.doInit('subclassName1 subclassName2 subclassName3 etc');

Example

TheM.doInit('common user companies genericRequests');

Properties

Property table for TheM.companies

Property Description Required Schema
length Gets (returns) the length of the companies array. Yes {
  "title": "TheM.companies.length",
  "type": "number",
  "description": "Gets (returns) the length of the
companies array.",
  "examples": [
    1
  ],
  "default": 0,
  "nullable": false
}
isReady Gets (returns) or sets true if TheM.companies is fully ready. When setting isReady true for the first time, a(n) 'TheM.companies ready' event is also triggered. Yes {
  "title": "TheM.companies.isReady",
  "type": "boolean",
  "description": "Gets (returns) or sets true if
TheM.companies is fully ready. When setting
isReady true for the first time, a(n)
'TheM.companies ready' event is also triggered.",
  "$comment": "getter setter",
  "examples": [
    true,
    false
  ],
  "default": false,
  "nullable": false
}

Methods

Method Name Parameter Descriptions Description Example
doSave
[]
Saves companies data in local storage. Normally, there is no need to use this method as the framework knows automatically when to save and when to load the data to and from local storage. Returns true. TheM.companies.doSave();
doLoad
[]
Loads companies data from local storage and returns a boolean value to indicate success. Normally, there is no need to use this method as the framework knows automatically when to save and when to load the data to and from local storage. TheM.companies.doLoad();
doUpdate
[
{
"title": "given",
"type": "boolean",
"nullable": true,
"example": true,
"$comment": "Forces framework to
pull fresh data from server if
true."
}
]
Causes framework to pull fresh companies data from the server. If the data is fresh enough, meaning an update has happened recently, the framework will ignore the suggestion. However, you can force the framework to update the data by sending true as an argument. On success, a(n) 'modelBank companies refreshed' event will occur. TheM.companies.doUpdate(true);
company
[
{
"title": "givenAFiCompanyId",
"type": "string",
"nullable": false,
"example":
"lyrej3zzfvfvpyjbntxuabqavlimi
v"
}
]
Returns the Company specified by the givenAFiCompanyId parameter, if a match exists. TheM.companies.company("lyrej3zzfvfvpyjbntxuabqavlimiv");

Submodules

Submodule Name Link
Company Company Reference