1.1.3 • Published 12 months ago
@eohjsc/era-widget v1.1.3
E-Ra Widget
Library to create E-Ra widget
Installation
npm install @eohjsc/era-widget
yarn add @eohjsc/era-widget
<script src="https://www.unpkg.com/@eohjsc/era-widget@1.1.1/src/index.js"></script>
Usage
import eraWidget from '@eohjsc/era-widget';
eraWidget.init({
onConfiguration: (configuration) => {
console.log('configuration', configuration);
},
onHistory: (history) => {
console.log('history', history);
},
onValues: (values) => {
console.log('values', values);
},
});
// call when need to request history
eraWidget.requestHistories(startTime, endTime);
Options
Name | Type | Default | Description |
---|---|---|---|
onConfiguration | Function | null | Callback function when configuration is received |
onHistory | Function | null | Callback function when history is received |
onValues | Function | null | Callback function when values are received |
ready | boolean | true | Auto send ready message after initializing |
mobileHeight | number | 300 | Height of widget on mobile |
needRealtimeConfigs | boolean | true | Need realtime configs |
needHistoryConfigs | boolean | true | Need history configs |
needActions | boolean | true | Need actions |
maxRealtimeConfigsCount | number | 0 | Maximum number of realtime configs (0 is unlimited) |
maxHistoryConfigsCount | number | 0 | Maximum number of history configs (0 is unlimited) |
maxActionsCount | number | 0 | Maximum number of actions (0 is unlimited) |
minRealtimeConfigsCount | number | 0 | Minimum number of realtime configs |
minHistoryConfigsCount | number | 0 | Minimum number of history configs |
minActionsCount | number | 0 | Minimum number of actions |
Methods
Name | Description |
---|---|
requestAdjustMobileHeight(height: integer) | Request to adjust mobile height |
ready() | Send ready message |
requestHistories(start: datetime, end:datetime) | Request histories |
triggerAction(actionKey: uuid4, actionIndex: integer, data: object) | Trigger action |
Attributes
Name | Description | Example |
---|---|---|
configuration | Widget configuration | {url, realtime_configs, history_configs, actions } |
Events
Name | Description | Example |
---|---|---|
configuration | widget configuration | {url, realtime_configs : [ { name, color, sensor_id, chip_id, id } ], history_configs: [ { name, color, sensor_id, chip_id, id } ]} |
values | realtime config value | { 1 : {value: 2} } |
histories | history data | [{data: [{x, y}], name, color, sensor_id, chip_id, id }] |
1.1.3
12 months ago
1.1.0
12 months ago
1.0.19
12 months ago
1.0.18
12 months ago
1.0.17
12 months ago
1.0.16
1 year ago
1.0.15
1 year ago
1.0.14
1 year ago
1.0.13
1 year ago
1.0.12
1 year ago
1.0.11
1 year ago
1.0.10
1 year ago
1.0.9
1 year ago
1.0.8
1 year ago
1.0.7
1 year ago
1.0.6
1 year ago
1.0.5
1 year ago
1.0.4
1 year ago
1.0.3
1 year ago
1.0.2
1 year ago
1.0.1
1 year ago
1.0.0
1 year ago