1.1.3 • Published 2 years ago
@eohjsc/era-widget v1.1.3
E-Ra Widget
Library to create E-Ra widget
Installation
npm install @eohjsc/era-widgetyarn 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
2 years ago
1.1.0
2 years ago
1.0.19
2 years ago
1.0.18
2 years ago
1.0.17
2 years ago
1.0.16
2 years ago
1.0.15
2 years ago
1.0.14
2 years ago
1.0.13
2 years ago
1.0.12
2 years ago
1.0.11
2 years ago
1.0.10
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago