1.1.3 • Published 12 months ago

@eohjsc/era-widget v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

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

NameTypeDefaultDescription
onConfigurationFunctionnullCallback function when configuration is received
onHistoryFunctionnullCallback function when history is received
onValuesFunctionnullCallback function when values are received
readybooleantrueAuto send ready message after initializing
mobileHeightnumber300Height of widget on mobile
needRealtimeConfigsbooleantrueNeed realtime configs
needHistoryConfigsbooleantrueNeed history configs
needActionsbooleantrueNeed actions
maxRealtimeConfigsCountnumber0Maximum number of realtime configs (0 is unlimited)
maxHistoryConfigsCountnumber0Maximum number of history configs (0 is unlimited)
maxActionsCountnumber0Maximum number of actions (0 is unlimited)
minRealtimeConfigsCountnumber0Minimum number of realtime configs
minHistoryConfigsCountnumber0Minimum number of history configs
minActionsCountnumber0Minimum number of actions

Methods

NameDescription
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

NameDescriptionExample
configurationWidget configuration{url, realtime_configs, history_configs, actions }

Events

NameDescriptionExample
configurationwidget configuration{url, realtime_configs : [ { name, color, sensor_id, chip_id, id } ], history_configs: [ { name, color, sensor_id, chip_id, id } ]}
valuesrealtime config value{ 1 : {value: 2} }
historieshistory 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