@openremote/core 1.8.0-snapshot.20250725070921 → 1.8.0-snapshot.20250725120000
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -105
- package/dist/umd/index.bundle.js.map +1 -1
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.orbundle.js +49 -49
- package/dist/umd/index.orbundle.js.map +1 -1
- package/lib/asset-mixin.js +161 -1
- package/lib/console.js +541 -1
- package/lib/defaults.js +16 -1
- package/lib/event.js +588 -1
- package/lib/index.js +1003 -1
- package/lib/util.js +1000 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
# @openremote/core
|
|
2
|
-
[![NPM Version][npm-image]][npm-url]
|
|
3
|
-
[![Linux Build][travis-image]][travis-url]
|
|
4
|
-
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
5
|
-
|
|
6
|
-
ES6 modules for connecting to an OpenRemote Manager as well as utilities for performing common tasks.
|
|
7
|
-
|
|
8
|
-
The default export is a singleton of type `Manager` that can be used to connect to an OpenRemote Manager, initiate
|
|
9
|
-
authentication and download common resources (translation files, icons, etc). Everything is initiated by calling
|
|
10
|
-
the `init` method, what tasks are performed during initialisation is determined by the `ManagerConfig` passed to the
|
|
11
|
-
`init`, the tasks include the following:
|
|
12
|
-
|
|
13
|
-
* Check the manager exists and is accessible (calls the `api/master/info` endpoint)
|
|
14
|
-
* Initialise authentication and perform login redirect (if requested in the `ManagerConfig`)
|
|
15
|
-
* Download `mdi` iconset (if requested in the `ManagerConfig` - if not specified iconset will be downloaded)
|
|
16
|
-
* Initialise REST API client (`@openremote/rest`) - Sets a timeout of 10s and will also add a request interceptor to
|
|
17
|
-
add required `Authorization` header for authentication
|
|
18
|
-
* Initialise console (the console is the device used to render the application desktop, Android or iOS device)
|
|
19
|
-
* Download built in OpenRemote translation files
|
|
20
|
-
* Download Asset Model Descriptors
|
|
21
|
-
|
|
22
|
-
## Install
|
|
23
|
-
```bash
|
|
24
|
-
npm i @openremote/core
|
|
25
|
-
yarn add @openremote/core
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Usage
|
|
29
|
-
For a full list of properties, methods and options refer to the TypeDoc generated [documentation]().
|
|
30
|
-
|
|
31
|
-
Initialisation is done by calling the `init` method which returns a Promise that is fulfilled with a `boolean` indicating
|
|
32
|
-
whether initialisation was successful or not.
|
|
33
|
-
|
|
34
|
-
Initialisation usage example:
|
|
35
|
-
|
|
36
|
-
```$javascript
|
|
37
|
-
import openremote from "@openremote/core";
|
|
38
|
-
|
|
39
|
-
openremote.init({
|
|
40
|
-
managerUrl: "http://localhost:8080",
|
|
41
|
-
keycloakUrl: "http://localhost:8080/auth",
|
|
42
|
-
auth: Auth.KEYCLOAK,
|
|
43
|
-
autoLogin: false,
|
|
44
|
-
realm: "building",
|
|
45
|
-
configureTranslationsOptions: (options) => {
|
|
46
|
-
options.lng = "nl"; // Change initial language to dutch rather than english
|
|
47
|
-
}
|
|
48
|
-
}).then((success) => {
|
|
49
|
-
if (success) {
|
|
50
|
-
// Load the app
|
|
51
|
-
} else {
|
|
52
|
-
// Something has gone wrong
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
### Asset Mixin (`dist/asset-mixin`)
|
|
59
|
-
Exports a `subscribe` function/mixin that can be used by components to connect to one or more Assets in the OpenRemote
|
|
60
|
-
Manager; it takes care of subscribing to events for the specified Asset(s), usage example:
|
|
61
|
-
|
|
62
|
-
```$javascript
|
|
63
|
-
class AssetComponent extends subscribe(openremote) {
|
|
64
|
-
|
|
65
|
-
constructor() {
|
|
66
|
-
this.assetIds = [this.asset];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Override this method to be notified when an attribute event is received for a subscribed asset. This is called
|
|
70
|
-
// whenever an attribute's value is modified.
|
|
71
|
-
public onAttributeEvent(event: AttributeEvent) {}
|
|
72
|
-
|
|
73
|
-
// Override this method to be notified when an asset event is received for a subscribed asset. This is called when
|
|
74
|
-
// an asset is first subscribed or when an asset is modified (attribute value changes are handled as attribute events)
|
|
75
|
-
public onAssetEvent(event: AssetEvent) {}
|
|
76
|
-
|
|
77
|
-
// If you need to modify an attribute then call the sendAttributeEvent method; the event must be for a subscribed asset.
|
|
78
|
-
doSendEvent(event: AttributeEvent) {
|
|
79
|
-
this.sendAttributeEvent(event);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Events (`./dist/event`)
|
|
85
|
-
Provides infrastructure for connecting to the OpenRemote Manager client event bus; by default an `EventProvider` instance
|
|
86
|
-
`Manager` is initialised by the `Manager` during the initialisation process and can be accessed from `openremote.events`
|
|
87
|
-
but it is also possible to instantiate an `EventProvider` manually.
|
|
88
|
-
|
|
89
|
-
### Util (`./dist/util`)
|
|
90
|
-
Various utility methods for common tasks.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
## Supported Browsers
|
|
94
|
-
The last 2 versions of all modern browsers are supported, including Chrome, Safari, Opera, Firefox, Edge. In addition,
|
|
95
|
-
Internet Explorer 11 is also supported.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
## License
|
|
99
|
-
[GNU AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)
|
|
100
|
-
|
|
101
|
-
[npm-image]: https://img.shields.io/npm/v/live-xxx.svg
|
|
102
|
-
[npm-url]: https://npmjs.org/package/@openremote/core
|
|
103
|
-
[travis-image]: https://img.shields.io/travis/live-js/live-xxx/master.svg
|
|
104
|
-
[travis-url]: https://travis-ci.org/live-js/live-xxx
|
|
105
|
-
[coveralls-image]: https://img.shields.io/coveralls/live-js/live-xxx/master.svg
|
|
1
|
+
# @openremote/core
|
|
2
|
+
[![NPM Version][npm-image]][npm-url]
|
|
3
|
+
[![Linux Build][travis-image]][travis-url]
|
|
4
|
+
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
5
|
+
|
|
6
|
+
ES6 modules for connecting to an OpenRemote Manager as well as utilities for performing common tasks.
|
|
7
|
+
|
|
8
|
+
The default export is a singleton of type `Manager` that can be used to connect to an OpenRemote Manager, initiate
|
|
9
|
+
authentication and download common resources (translation files, icons, etc). Everything is initiated by calling
|
|
10
|
+
the `init` method, what tasks are performed during initialisation is determined by the `ManagerConfig` passed to the
|
|
11
|
+
`init`, the tasks include the following:
|
|
12
|
+
|
|
13
|
+
* Check the manager exists and is accessible (calls the `api/master/info` endpoint)
|
|
14
|
+
* Initialise authentication and perform login redirect (if requested in the `ManagerConfig`)
|
|
15
|
+
* Download `mdi` iconset (if requested in the `ManagerConfig` - if not specified iconset will be downloaded)
|
|
16
|
+
* Initialise REST API client (`@openremote/rest`) - Sets a timeout of 10s and will also add a request interceptor to
|
|
17
|
+
add required `Authorization` header for authentication
|
|
18
|
+
* Initialise console (the console is the device used to render the application desktop, Android or iOS device)
|
|
19
|
+
* Download built in OpenRemote translation files
|
|
20
|
+
* Download Asset Model Descriptors
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
```bash
|
|
24
|
+
npm i @openremote/core
|
|
25
|
+
yarn add @openremote/core
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
For a full list of properties, methods and options refer to the TypeDoc generated [documentation]().
|
|
30
|
+
|
|
31
|
+
Initialisation is done by calling the `init` method which returns a Promise that is fulfilled with a `boolean` indicating
|
|
32
|
+
whether initialisation was successful or not.
|
|
33
|
+
|
|
34
|
+
Initialisation usage example:
|
|
35
|
+
|
|
36
|
+
```$javascript
|
|
37
|
+
import openremote from "@openremote/core";
|
|
38
|
+
|
|
39
|
+
openremote.init({
|
|
40
|
+
managerUrl: "http://localhost:8080",
|
|
41
|
+
keycloakUrl: "http://localhost:8080/auth",
|
|
42
|
+
auth: Auth.KEYCLOAK,
|
|
43
|
+
autoLogin: false,
|
|
44
|
+
realm: "building",
|
|
45
|
+
configureTranslationsOptions: (options) => {
|
|
46
|
+
options.lng = "nl"; // Change initial language to dutch rather than english
|
|
47
|
+
}
|
|
48
|
+
}).then((success) => {
|
|
49
|
+
if (success) {
|
|
50
|
+
// Load the app
|
|
51
|
+
} else {
|
|
52
|
+
// Something has gone wrong
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### Asset Mixin (`dist/asset-mixin`)
|
|
59
|
+
Exports a `subscribe` function/mixin that can be used by components to connect to one or more Assets in the OpenRemote
|
|
60
|
+
Manager; it takes care of subscribing to events for the specified Asset(s), usage example:
|
|
61
|
+
|
|
62
|
+
```$javascript
|
|
63
|
+
class AssetComponent extends subscribe(openremote) {
|
|
64
|
+
|
|
65
|
+
constructor() {
|
|
66
|
+
this.assetIds = [this.asset];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Override this method to be notified when an attribute event is received for a subscribed asset. This is called
|
|
70
|
+
// whenever an attribute's value is modified.
|
|
71
|
+
public onAttributeEvent(event: AttributeEvent) {}
|
|
72
|
+
|
|
73
|
+
// Override this method to be notified when an asset event is received for a subscribed asset. This is called when
|
|
74
|
+
// an asset is first subscribed or when an asset is modified (attribute value changes are handled as attribute events)
|
|
75
|
+
public onAssetEvent(event: AssetEvent) {}
|
|
76
|
+
|
|
77
|
+
// If you need to modify an attribute then call the sendAttributeEvent method; the event must be for a subscribed asset.
|
|
78
|
+
doSendEvent(event: AttributeEvent) {
|
|
79
|
+
this.sendAttributeEvent(event);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Events (`./dist/event`)
|
|
85
|
+
Provides infrastructure for connecting to the OpenRemote Manager client event bus; by default an `EventProvider` instance
|
|
86
|
+
`Manager` is initialised by the `Manager` during the initialisation process and can be accessed from `openremote.events`
|
|
87
|
+
but it is also possible to instantiate an `EventProvider` manually.
|
|
88
|
+
|
|
89
|
+
### Util (`./dist/util`)
|
|
90
|
+
Various utility methods for common tasks.
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
## Supported Browsers
|
|
94
|
+
The last 2 versions of all modern browsers are supported, including Chrome, Safari, Opera, Firefox, Edge. In addition,
|
|
95
|
+
Internet Explorer 11 is also supported.
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
[GNU AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)
|
|
100
|
+
|
|
101
|
+
[npm-image]: https://img.shields.io/npm/v/live-xxx.svg
|
|
102
|
+
[npm-url]: https://npmjs.org/package/@openremote/core
|
|
103
|
+
[travis-image]: https://img.shields.io/travis/live-js/live-xxx/master.svg
|
|
104
|
+
[travis-url]: https://travis-ci.org/live-js/live-xxx
|
|
105
|
+
[coveralls-image]: https://img.shields.io/coveralls/live-js/live-xxx/master.svg
|
|
106
106
|
[coveralls-url]: https://coveralls.io/r/live-js/live-xxx?branch=master
|