Setting
Mixin Extends:
Helper class representing an setting.
Example:
import { Setting, settingService } from 'clinical6';
// Typically use settingService.get()
settingService.get().then(settings => console.log(settings));
let setting;
setting = new Setting({
id: 'timeout',
attributes: {
value: 30
}
});
setting = new Setting('logo', 'logo.png');
setting = new Setting({
id: 'advertisements',
attributes: {
value: {
display_time: 5,
transition_time: 1
}
}
});
Constructor Summary
Public Constructor | ||
public |
constructor(json: Object) Constructor for helper class representing an Setting |
Method Summary
Public Methods | ||
public |
Saves a setting (insert if id doesn't exist, update if it does) |
Inherited Summary
From class SettingModel | ||
public |
|
|
public |
value: any |
Public Constructors
public constructor(json: Object) source
Constructor for helper class representing an Setting
Override:
SettingModel#constructorParams:
Name | Type | Attribute | Description |
json | Object | json api response from server |
Public Methods
public save(): Promise<Setting> source
Saves a setting (insert if id doesn't exist, update if it does)
Example:
import { Setting, settingService } from 'clinical6';
// Insert is different from other inserts. Uses mobile application key
const setting = new Setting({
"value": "You are a winner"
});
setting.save();
// After you have the authtoken and then you've logged in
// Updates existing setting (has existing id)
settingService.get().then(settings => settings[0].save());
// Can also use get with a string
settingService.get({ id: 'timeout' }).then(s => s.save());