Skip to content

TheM.ious 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 accounts cards family ious');

Properties

Property table for TheM.ious

Property Description Required Schema
balance Gets (returns) the total amount owed to/by the current user across all of the user's IOUAccount instances. Yes {
  "title": "TheM.ious.balance",
  "type": "number",
  "description": "Gets (returns) the total amount
owed to/by the current user across all of the user's
IOUAccount instances.",
  "$comment": "getter",
  "examples": [
    40.04
  ],
  "nullable": false
}
isReady Gets (returns) or sets true if TheM.ious is fully ready. When setting isReady true for the first time, a(n) 'TheM.ious ready' event is also triggered. Yes {
  "title": "TheM.ious.isReady",
  "type": "boolean",
  "description": "Gets (returns) or sets true if
TheM.ious is fully ready. When setting isReady true
for the first time, a(n) 'TheM.ious ready' event is
also triggered.",
  "$comment": "getter setter",
  "examples": [
    true,
    false
  ],
  "default": false,
  "nullable": false
}

Methods

Method Name Parameter Descriptions Description Example
doSave
[]
Saves ious 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.ious.doSave();
doLoad
[]
Loads ious 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.ious.doLoad();
doUpdate
[
{
"title": "given",
"type": "boolean",
"nullable": true,
"example": true,
"$comment": "Forces framework to
pull fresh data from server if
true."
}
]
Returns a promise that causes the framework to pull fresh ious 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 ious refreshed' event will occur. TheM.ious.doUpdate(true);
doRegister
[
{
"title": "given",
"type": "object",
"nullable": false,
"properties": {
"borrowerAFiUserId": {
"title": "borrowerAFiUserId",
"type": "string",
"nullable": false
},
"lenderAFiUserId": {
"title": "lenderAFiUserId",
"type": "string",
"nullable": false
},
"amount": {
"title": "amount",
"type": "number",
"nullable": false
},
"currency": {
"title": "currency",
"type": "string",
"nullable": true,
"$comment": "If currency is not
specified, then
TheM.user.homecurrency will be
used."
},
"narrativeDebit": {
"title": "narrativeDebit",
"type": "string",
"nullable": true
},
"narrativeCredit": {
"title": "narrativeCredit",
"type": "string",
"nullable": true
},
"narrative": {
"title": "narrative",
"type": "string",
"nullable": true
},
"isPending": {
"title": "isPending",
"type": "boolean",
"nullable": true,
"default": true
}
},
"example": {
"borrowerAFiUserId":
"qweaurlysmbdlsrf",
"lenderAFiUserId":
"testaurlx8wfimcrw",
"amount": 10.01,
"currency": "USD",
"narrativeDebit": "Loan
request",
"narrativeCredit": "Loan
request",
"narrative": "Loan request",
"isPending": true
}
}
]
Returns a promise that will create and submit an IOU registration request with the given properties to the server. TheM.ious.doRegister(
  {
   "borrowerAFiUserId": "qweaurlysmbdlsrf",
   "lenderAFiUserId": "testaurlx8wfimcrw",
   "amount": 10.01,
   "currency": "USD",
   "narrativeDebit": "Loan request",
   "narrativeCredit": "Loan request",
   "narrative": "Loan request",
   "isPending": true
  }
);
forUser
[
{
"title": "givenAFiUserId",
"type": "string",
"nullable": false,
"example": "qweaurlysmbdlsrf"
}
]
Returns an IOUAccount for which the givenAFiUserId is either the borrower (if givenAFiUserId represents the current user) or the lender (if givenAFiUserId represents another user). TheM.ious.forUser("qweaurlysmbdlsrf");

Submodules

Submodule Name Link
IouAccount IouAccount Reference