@photon-os/sdk 0.5.0-beta0 → 0.5.1-beta1
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/lib/CoreServices/Apps/App.d.ts +6 -6
- package/lib/CoreServices/Apps/App.js +9 -9
- package/lib/CoreServices/Apps/AppRegistry.d.ts +6 -6
- package/lib/CoreServices/Apps/AppRegistry.js +15 -15
- package/lib/CoreServices/Apps/Launcher.d.ts +5 -5
- package/lib/CoreServices/Apps/Launcher.js +9 -9
- package/lib/CoreServices/Apps/PhotonApp.d.ts +6 -6
- package/lib/CoreServices/Apps/PhotonApp.js +33 -35
- package/lib/CoreServices/Apps/PhotonAppMode.d.ts +5 -5
- package/lib/CoreServices/Apps/PhotonAppMode.js +8 -8
- package/lib/CoreServices/Apps/UserPreferences.d.ts +6 -6
- package/lib/CoreServices/Apps/UserPreferences.js +15 -15
- package/lib/CoreServices/HomeBar.d.ts +4 -4
- package/lib/CoreServices/HomeBar.js +8 -8
- package/lib/CoreServices/StatusBar/StatusBar.d.ts +9 -8
- package/lib/CoreServices/StatusBar/StatusBar.js +37 -36
- package/lib/CoreServices/StatusBar/StatusBarContentType.d.ts +5 -5
- package/lib/CoreServices/StatusBar/StatusBarContentType.js +8 -8
- package/lib/SecondLife/PhotonTool.d.ts +33 -33
- package/lib/SecondLife/PhotonTool.js +100 -100
- package/lib/SecondLife/SecondLifeDevice.d.ts +9 -9
- package/lib/SecondLife/SecondLifeDevice.js +12 -12
- package/lib/SecondLife/SecondLifeIdentity.d.ts +4 -5
- package/lib/SecondLife/SecondLifeIdentity.js +9 -30
- package/lib/SecondLife/SecondLifeProxy.d.ts +5 -5
- package/lib/SecondLife/SecondLifeProxy.js +8 -8
- package/lib/SecondLife/SecondLifeRegistry.d.ts +5 -5
- package/lib/SecondLife/SecondLifeRegistry.js +22 -22
- package/lib/Sensor/Sensor.d.ts +6 -6
- package/lib/Sensor/Sensor.js +31 -31
- package/lib/Sensor/SensorResult.d.ts +14 -14
- package/lib/Sensor/SensorResult.js +1 -1
- package/lib/SystemEvents/EventManager.d.ts +14 -14
- package/lib/SystemEvents/EventManager.js +38 -38
- package/lib/SystemEvents/LifecycleEventNames.d.ts +5 -5
- package/lib/SystemEvents/LifecycleEventNames.js +8 -8
- package/lib/SystemEvents/LifecycleEvents.d.ts +5 -7
- package/lib/SystemEvents/LifecycleEvents.js +18 -19
- package/lib/SystemMessaging/BrowserMessageListener.d.ts +10 -11
- package/lib/SystemMessaging/BrowserMessageListener.js +21 -21
- package/lib/SystemMessaging/BrowserMessagingTarget.d.ts +9 -9
- package/lib/SystemMessaging/BrowserMessagingTarget.js +13 -13
- package/lib/SystemMessaging/IMessage.d.ts +6 -6
- package/lib/SystemMessaging/IMessage.js +2 -2
- package/lib/SystemMessaging/IMessageListener.d.ts +8 -9
- package/lib/SystemMessaging/IMessageListener.js +2 -2
- package/lib/SystemMessaging/IMessagingTarget.d.ts +5 -5
- package/lib/SystemMessaging/IMessagingTarget.js +2 -2
- package/lib/SystemMessaging/MessageBroker.d.ts +30 -30
- package/lib/SystemMessaging/MessageBroker.js +147 -147
- package/lib/SystemMessaging/SecondLIfeMessagingListener.d.ts +13 -14
- package/lib/SystemMessaging/SecondLIfeMessagingListener.js +28 -28
- package/lib/SystemMessaging/SecondLifeMessagingTarget.d.ts +9 -9
- package/lib/SystemMessaging/SecondLifeMessagingTarget.js +13 -13
- package/lib/SystemMessaging/VoidMessagingTarget.d.ts +7 -7
- package/lib/SystemMessaging/VoidMessagingTarget.js +12 -12
- package/lib/index.d.ts +22 -22
- package/lib/index.js +46 -46
- package/package.json +29 -29
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const __1 = require("..");
|
|
13
|
-
const SecondLifeRegistry_1 = require("./SecondLifeRegistry");
|
|
14
|
-
var ChatVolume;
|
|
15
|
-
(function (ChatVolume) {
|
|
16
|
-
ChatVolume[ChatVolume["Normal"] = 0] = "Normal";
|
|
17
|
-
ChatVolume[ChatVolume["Whisper"] = 1] = "Whisper";
|
|
18
|
-
ChatVolume[ChatVolume["Shout"] = 2] = "Shout";
|
|
19
|
-
ChatVolume[ChatVolume["RegionSay"] = 3] = "RegionSay";
|
|
20
|
-
})(ChatVolume || (ChatVolume = {}));
|
|
21
|
-
var SensorType;
|
|
22
|
-
(function (SensorType) {
|
|
23
|
-
SensorType[SensorType["AGENT"] = 1] = "AGENT";
|
|
24
|
-
})(SensorType || (SensorType = {}));
|
|
25
|
-
class PhotonTool {
|
|
26
|
-
constructor(device) {
|
|
27
|
-
this.device = device;
|
|
28
|
-
}
|
|
29
|
-
say(channel, message) {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
yield this.chat(ChatVolume.Normal, channel, message);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
shout(channel, message) {
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
yield this.chat(ChatVolume.Shout, channel, message);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
whisper(channel, message) {
|
|
40
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
yield this.chat(ChatVolume.Whisper, channel, message);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
regionSay(channel, message) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
yield this.chat(ChatVolume.RegionSay, channel, message);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
ownerSay(message) {
|
|
50
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
yield __1.MessageBroker.defaultMessageBroker.invoke(this.device.target, "pt_Communication", "ownerSay", [message]);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
chat(volume, channel, message) {
|
|
55
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
yield __1.MessageBroker.defaultMessageBroker.invoke(this.device.target, "pt_Communication", "say", [volume, channel, message]);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
sensor(options = {}) {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const results = yield __1.MessageBroker.defaultMessageBroker.invoke(this.device.target, "pt_Sensor", "sensor", [
|
|
62
|
-
options.name || "",
|
|
63
|
-
options.key || "NULL_KEY",
|
|
64
|
-
options.type || SensorType.AGENT,
|
|
65
|
-
options.range || 96,
|
|
66
|
-
options.arc || "TWO_PI",
|
|
67
|
-
]);
|
|
68
|
-
return results;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
giveInventoryItem(inventoryItemName, recipientUuid) {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
yield __1.MessageBroker.defaultMessageBroker.invoke(this.device.target, "pt_Inventory", "giveInventory", [inventoryItemName, recipientUuid]);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
invokeCommand(command) {
|
|
77
|
-
__1.MessageBroker.defaultMessageBroker.invoke(this.device.target, "pt_Legacy", "invokeCommand", [command]);
|
|
78
|
-
}
|
|
79
|
-
static getPhotonTool() {
|
|
80
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
const deviceList = yield SecondLifeRegistry_1.default.getDevices();
|
|
82
|
-
const matchingDevice = deviceList.find((d) => d.name.indexOf("Photon Tool") > -1);
|
|
83
|
-
if (!matchingDevice) {
|
|
84
|
-
throw new Error("Photon Tool is not connected.");
|
|
85
|
-
}
|
|
86
|
-
return new PhotonTool(matchingDevice);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
static isPhotonToolConnected() {
|
|
90
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
const deviceList = yield SecondLifeRegistry_1.default.getDevices();
|
|
92
|
-
const matchingDevice = deviceList.find((d) => d.name.indexOf("Photon Tool") > -1);
|
|
93
|
-
if (!matchingDevice) {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
return true;
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
exports.default = PhotonTool;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const __1 = require("..");
|
|
13
|
+
const SecondLifeRegistry_1 = require("./SecondLifeRegistry");
|
|
14
|
+
var ChatVolume;
|
|
15
|
+
(function (ChatVolume) {
|
|
16
|
+
ChatVolume[ChatVolume["Normal"] = 0] = "Normal";
|
|
17
|
+
ChatVolume[ChatVolume["Whisper"] = 1] = "Whisper";
|
|
18
|
+
ChatVolume[ChatVolume["Shout"] = 2] = "Shout";
|
|
19
|
+
ChatVolume[ChatVolume["RegionSay"] = 3] = "RegionSay";
|
|
20
|
+
})(ChatVolume || (ChatVolume = {}));
|
|
21
|
+
var SensorType;
|
|
22
|
+
(function (SensorType) {
|
|
23
|
+
SensorType[SensorType["AGENT"] = 1] = "AGENT";
|
|
24
|
+
})(SensorType || (SensorType = {}));
|
|
25
|
+
class PhotonTool {
|
|
26
|
+
constructor(device) {
|
|
27
|
+
this.device = device;
|
|
28
|
+
}
|
|
29
|
+
say(channel, message) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
yield this.chat(ChatVolume.Normal, channel, message);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
shout(channel, message) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
yield this.chat(ChatVolume.Shout, channel, message);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
whisper(channel, message) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
yield this.chat(ChatVolume.Whisper, channel, message);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
regionSay(channel, message) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
yield this.chat(ChatVolume.RegionSay, channel, message);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
ownerSay(message) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
yield __1.MessageBroker.defaultMessageBroker.invoke(this.device.target, "pt_Communication", "ownerSay", [message]);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
chat(volume, channel, message) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
yield __1.MessageBroker.defaultMessageBroker.invoke(this.device.target, "pt_Communication", "say", [volume, channel, message]);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
sensor(options = {}) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const results = yield __1.MessageBroker.defaultMessageBroker.invoke(this.device.target, "pt_Sensor", "sensor", [
|
|
62
|
+
options.name || "",
|
|
63
|
+
options.key || "NULL_KEY",
|
|
64
|
+
options.type || SensorType.AGENT,
|
|
65
|
+
options.range || 96,
|
|
66
|
+
options.arc || "TWO_PI",
|
|
67
|
+
]);
|
|
68
|
+
return results;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
giveInventoryItem(inventoryItemName, recipientUuid) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
yield __1.MessageBroker.defaultMessageBroker.invoke(this.device.target, "pt_Inventory", "giveInventory", [inventoryItemName, recipientUuid]);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
invokeCommand(command) {
|
|
77
|
+
__1.MessageBroker.defaultMessageBroker.invoke(this.device.target, "pt_Legacy", "invokeCommand", [command]);
|
|
78
|
+
}
|
|
79
|
+
static getPhotonTool() {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
const deviceList = yield SecondLifeRegistry_1.default.getDevices();
|
|
82
|
+
const matchingDevice = deviceList.find((d) => d.name.indexOf("Photon Tool") > -1);
|
|
83
|
+
if (!matchingDevice) {
|
|
84
|
+
throw new Error("Photon Tool is not connected.");
|
|
85
|
+
}
|
|
86
|
+
return new PhotonTool(matchingDevice);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
static isPhotonToolConnected() {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
const deviceList = yield SecondLifeRegistry_1.default.getDevices();
|
|
92
|
+
const matchingDevice = deviceList.find((d) => d.name.indexOf("Photon Tool") > -1);
|
|
93
|
+
if (!matchingDevice) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
return true;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.default = PhotonTool;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { SecondLifeMessagingTarget } from "..";
|
|
2
|
-
declare class SecondLifeDevice {
|
|
3
|
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
lastSeen: any;
|
|
6
|
-
target: SecondLifeMessagingTarget;
|
|
7
|
-
constructor(id: string, name: string, lastSeen: any);
|
|
8
|
-
}
|
|
9
|
-
export default SecondLifeDevice;
|
|
1
|
+
import { SecondLifeMessagingTarget } from "..";
|
|
2
|
+
declare class SecondLifeDevice {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
lastSeen: any;
|
|
6
|
+
target: SecondLifeMessagingTarget;
|
|
7
|
+
constructor(id: string, name: string, lastSeen: any);
|
|
8
|
+
}
|
|
9
|
+
export default SecondLifeDevice;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const __1 = require("..");
|
|
4
|
-
class SecondLifeDevice {
|
|
5
|
-
constructor(id, name, lastSeen) {
|
|
6
|
-
this.id = id;
|
|
7
|
-
this.name = name;
|
|
8
|
-
this.lastSeen = lastSeen;
|
|
9
|
-
this.target = new __1.SecondLifeMessagingTarget(this.id, __1.PhotonApp.appId, __1.SecondLifeProxy.socket);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.default = SecondLifeDevice;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const __1 = require("..");
|
|
4
|
+
class SecondLifeDevice {
|
|
5
|
+
constructor(id, name, lastSeen) {
|
|
6
|
+
this.id = id;
|
|
7
|
+
this.name = name;
|
|
8
|
+
this.lastSeen = lastSeen;
|
|
9
|
+
this.target = new __1.SecondLifeMessagingTarget(this.id, __1.PhotonApp.appId, __1.SecondLifeProxy.socket);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.default = SecondLifeDevice;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
declare class SecondLifeIdentity {
|
|
2
|
-
static
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export default SecondLifeIdentity;
|
|
1
|
+
declare class SecondLifeIdentity {
|
|
2
|
+
static getKey(): string | null;
|
|
3
|
+
}
|
|
4
|
+
export default SecondLifeIdentity;
|
|
@@ -1,30 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const __1 = require("..");
|
|
13
|
-
class SecondLifeIdentity {
|
|
14
|
-
static getKeyFromQueryString() {
|
|
15
|
-
if (window.parent !== window) {
|
|
16
|
-
throw new Error("Unable to fetch key from query string within an app frame. Did you mean to call SecondLifeIdentity.getKey() instead?");
|
|
17
|
-
}
|
|
18
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
19
|
-
return urlParams.get("key");
|
|
20
|
-
}
|
|
21
|
-
static getKey() {
|
|
22
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
if (window.parent === window) {
|
|
24
|
-
throw new Error("To fetch the user's key outside of an app frame, use SecondLifeIdentity.getKeyFromQueryString() instead.");
|
|
25
|
-
}
|
|
26
|
-
return yield __1.MessageBroker.defaultMessageBroker.invoke(__1.MessageBroker.defaultMessageBroker.getTargetById("os"), "os_SecondLifeIdentity", "getKey");
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.default = SecondLifeIdentity;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class SecondLifeIdentity {
|
|
4
|
+
static getKey() {
|
|
5
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
6
|
+
return urlParams.get("key");
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.default = SecondLifeIdentity;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
declare class SecondLifeProxy {
|
|
2
|
-
static proxyUrl: string;
|
|
3
|
-
static socket: any;
|
|
4
|
-
}
|
|
5
|
-
export default SecondLifeProxy;
|
|
1
|
+
declare class SecondLifeProxy {
|
|
2
|
+
static proxyUrl: string;
|
|
3
|
+
static socket: any;
|
|
4
|
+
}
|
|
5
|
+
export default SecondLifeProxy;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const io = require("socket.io-client");
|
|
4
|
-
class SecondLifeProxy {
|
|
5
|
-
}
|
|
6
|
-
SecondLifeProxy.proxyUrl = "https://photon-proxy.
|
|
7
|
-
SecondLifeProxy.socket = io(SecondLifeProxy.proxyUrl);
|
|
8
|
-
exports.default = SecondLifeProxy;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const io = require("socket.io-client");
|
|
4
|
+
class SecondLifeProxy {
|
|
5
|
+
}
|
|
6
|
+
SecondLifeProxy.proxyUrl = "https://photon-proxy.1by3.co";
|
|
7
|
+
SecondLifeProxy.socket = io(SecondLifeProxy.proxyUrl);
|
|
8
|
+
exports.default = SecondLifeProxy;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import SecondLifeDevice from
|
|
2
|
-
declare class SecondLifeRegistry {
|
|
3
|
-
static getDevices(): Promise<SecondLifeDevice[]>;
|
|
4
|
-
}
|
|
5
|
-
export default SecondLifeRegistry;
|
|
1
|
+
import SecondLifeDevice from "./SecondLifeDevice";
|
|
2
|
+
declare class SecondLifeRegistry {
|
|
3
|
+
static getDevices(): Promise<SecondLifeDevice[]>;
|
|
4
|
+
}
|
|
5
|
+
export default SecondLifeRegistry;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const SecondLifeDevice_1 = require("./SecondLifeDevice");
|
|
13
|
-
const __1 = require("..");
|
|
14
|
-
class SecondLifeRegistry {
|
|
15
|
-
static getDevices() {
|
|
16
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const returnedDevices = yield __1.MessageBroker.defaultMessageBroker.invoke(__1.MessageBroker.defaultMessageBroker.getTargetById(
|
|
18
|
-
return returnedDevices.map((device) =>
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.default = SecondLifeRegistry;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const SecondLifeDevice_1 = require("./SecondLifeDevice");
|
|
13
|
+
const __1 = require("..");
|
|
14
|
+
class SecondLifeRegistry {
|
|
15
|
+
static getDevices() {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const returnedDevices = yield __1.MessageBroker.defaultMessageBroker.invoke(__1.MessageBroker.defaultMessageBroker.getTargetById("os"), "os_SecondLifeRegistry", "getDevices");
|
|
18
|
+
return returnedDevices.map((device) => new SecondLifeDevice_1.default(device.id, device.name, device.lastSeen));
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.default = SecondLifeRegistry;
|
package/lib/Sensor/Sensor.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare class Sensor {
|
|
2
|
-
static getData(): Promise<SensorResult[]>;
|
|
3
|
-
static on(eventName: "change", handler: Function): void;
|
|
4
|
-
static off(eventName: "change", handler?: Function): void;
|
|
5
|
-
}
|
|
6
|
-
export default Sensor;
|
|
1
|
+
declare class Sensor {
|
|
2
|
+
static getData(): Promise<SensorResult[]>;
|
|
3
|
+
static on(eventName: "change", handler: Function): void;
|
|
4
|
+
static off(eventName: "change", handler?: Function): void;
|
|
5
|
+
}
|
|
6
|
+
export default Sensor;
|
package/lib/Sensor/Sensor.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const __1 = require("..");
|
|
13
|
-
class Sensor {
|
|
14
|
-
static getData() {
|
|
15
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
const sensorData = yield __1.MessageBroker.defaultMessageBroker.invoke(__1.MessageBroker.defaultMessageBroker.getTargetById("os"), "os_Sensor", "getData");
|
|
17
|
-
return sensorData;
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
static on(eventName, handler) {
|
|
21
|
-
if (eventName !== "change")
|
|
22
|
-
return;
|
|
23
|
-
__1.EventManager.defaultEventManager.on("os_Sensor_Changed", handler);
|
|
24
|
-
}
|
|
25
|
-
static off(eventName, handler) {
|
|
26
|
-
if (eventName !== "change")
|
|
27
|
-
return;
|
|
28
|
-
__1.EventManager.defaultEventManager.off("os_Sensor_Changed", handler);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.default = Sensor;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const __1 = require("..");
|
|
13
|
+
class Sensor {
|
|
14
|
+
static getData() {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const sensorData = yield __1.MessageBroker.defaultMessageBroker.invoke(__1.MessageBroker.defaultMessageBroker.getTargetById("os"), "os_Sensor", "getData");
|
|
17
|
+
return sensorData;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
static on(eventName, handler) {
|
|
21
|
+
if (eventName !== "change")
|
|
22
|
+
return;
|
|
23
|
+
__1.EventManager.defaultEventManager.on("os_Sensor_Changed", handler);
|
|
24
|
+
}
|
|
25
|
+
static off(eventName, handler) {
|
|
26
|
+
if (eventName !== "change")
|
|
27
|
+
return;
|
|
28
|
+
__1.EventManager.defaultEventManager.off("os_Sensor_Changed", handler);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.default = Sensor;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
declare type SensorResult = {
|
|
2
|
-
id: string;
|
|
3
|
-
key: string;
|
|
4
|
-
name: string;
|
|
5
|
-
owner: string;
|
|
6
|
-
position: {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
z: number;
|
|
10
|
-
};
|
|
11
|
-
rotation: number[];
|
|
12
|
-
type: number;
|
|
13
|
-
lastSeen: Date;
|
|
14
|
-
};
|
|
1
|
+
declare type SensorResult = {
|
|
2
|
+
id: string;
|
|
3
|
+
key: string;
|
|
4
|
+
name: string;
|
|
5
|
+
owner: string;
|
|
6
|
+
position: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
z: number;
|
|
10
|
+
};
|
|
11
|
+
rotation: number[];
|
|
12
|
+
type: number;
|
|
13
|
+
lastSeen: Date;
|
|
14
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import IMessagingTarget from "../SystemMessaging/IMessagingTarget";
|
|
2
|
-
declare class EventManager {
|
|
3
|
-
static defaultEventManager: EventManager;
|
|
4
|
-
handlers: {
|
|
5
|
-
[eventName: string]: Function[];
|
|
6
|
-
};
|
|
7
|
-
constructor();
|
|
8
|
-
on(eventName: string, handler: Function): void;
|
|
9
|
-
off(eventName: string, handler?: Function): void;
|
|
10
|
-
emit(eventName: string, eventArgs?: any): void;
|
|
11
|
-
emitTo(target: IMessagingTarget, eventName: string, eventArgs?: any): void;
|
|
12
|
-
static setDefault(eventManager: EventManager): void;
|
|
13
|
-
}
|
|
14
|
-
export default EventManager;
|
|
1
|
+
import IMessagingTarget from "../SystemMessaging/IMessagingTarget";
|
|
2
|
+
declare class EventManager {
|
|
3
|
+
static defaultEventManager: EventManager;
|
|
4
|
+
handlers: {
|
|
5
|
+
[eventName: string]: Function[];
|
|
6
|
+
};
|
|
7
|
+
constructor();
|
|
8
|
+
on(eventName: string, handler: Function): void;
|
|
9
|
+
off(eventName: string, handler?: Function): void;
|
|
10
|
+
emit(eventName: string, eventArgs?: any): void;
|
|
11
|
+
emitTo(target: IMessagingTarget, eventName: string, eventArgs?: any): void;
|
|
12
|
+
static setDefault(eventManager: EventManager): void;
|
|
13
|
+
}
|
|
14
|
+
export default EventManager;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const MessageBroker_1 = require("../SystemMessaging/MessageBroker");
|
|
4
|
-
class EventManager {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.handlers = {};
|
|
7
|
-
MessageBroker_1.default.defaultMessageBroker.registerService('os_EventManager', {
|
|
8
|
-
handleEvent: (event) => {
|
|
9
|
-
if (!this.handlers[event.eventName])
|
|
10
|
-
return;
|
|
11
|
-
this.handlers[event.eventName].forEach((h) => h(event.eventArgs));
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
on(eventName, handler) {
|
|
16
|
-
this.handlers[eventName] = this.handlers[eventName] || [];
|
|
17
|
-
this.handlers[eventName].push(handler);
|
|
18
|
-
}
|
|
19
|
-
off(eventName, handler) {
|
|
20
|
-
if (handler) {
|
|
21
|
-
this.handlers[eventName] = this.handlers[eventName] || [];
|
|
22
|
-
this.handlers[eventName] = this.handlers[eventName].filter(h => h !== handler);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
delete this.handlers[eventName];
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
emit(eventName, eventArgs) {
|
|
29
|
-
MessageBroker_1.default.defaultMessageBroker.invokeEverywhere('os_EventManager', 'handleEvent', [{ eventName, eventArgs }]);
|
|
30
|
-
}
|
|
31
|
-
emitTo(target, eventName, eventArgs) {
|
|
32
|
-
MessageBroker_1.default.defaultMessageBroker.invoke(target, 'os_EventManager', 'handleEvent', [{ eventName, eventArgs }]);
|
|
33
|
-
}
|
|
34
|
-
static setDefault(eventManager) {
|
|
35
|
-
EventManager.defaultEventManager = eventManager;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
exports.default = EventManager;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const MessageBroker_1 = require("../SystemMessaging/MessageBroker");
|
|
4
|
+
class EventManager {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.handlers = {};
|
|
7
|
+
MessageBroker_1.default.defaultMessageBroker.registerService('os_EventManager', {
|
|
8
|
+
handleEvent: (event) => {
|
|
9
|
+
if (!this.handlers[event.eventName])
|
|
10
|
+
return;
|
|
11
|
+
this.handlers[event.eventName].forEach((h) => h(event.eventArgs));
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
on(eventName, handler) {
|
|
16
|
+
this.handlers[eventName] = this.handlers[eventName] || [];
|
|
17
|
+
this.handlers[eventName].push(handler);
|
|
18
|
+
}
|
|
19
|
+
off(eventName, handler) {
|
|
20
|
+
if (handler) {
|
|
21
|
+
this.handlers[eventName] = this.handlers[eventName] || [];
|
|
22
|
+
this.handlers[eventName] = this.handlers[eventName].filter(h => h !== handler);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
delete this.handlers[eventName];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
emit(eventName, eventArgs) {
|
|
29
|
+
MessageBroker_1.default.defaultMessageBroker.invokeEverywhere('os_EventManager', 'handleEvent', [{ eventName, eventArgs }]);
|
|
30
|
+
}
|
|
31
|
+
emitTo(target, eventName, eventArgs) {
|
|
32
|
+
MessageBroker_1.default.defaultMessageBroker.invoke(target, 'os_EventManager', 'handleEvent', [{ eventName, eventArgs }]);
|
|
33
|
+
}
|
|
34
|
+
static setDefault(eventManager) {
|
|
35
|
+
EventManager.defaultEventManager = eventManager;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.default = EventManager;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
declare enum LifecycleEventNames {
|
|
2
|
-
WillEnterForeground = "willEnterForeground",
|
|
3
|
-
WillEnterBackground = "willEnterBackground"
|
|
4
|
-
}
|
|
5
|
-
export default LifecycleEventNames;
|
|
1
|
+
declare enum LifecycleEventNames {
|
|
2
|
+
WillEnterForeground = "willEnterForeground",
|
|
3
|
+
WillEnterBackground = "willEnterBackground"
|
|
4
|
+
}
|
|
5
|
+
export default LifecycleEventNames;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var LifecycleEventNames;
|
|
4
|
-
(function (LifecycleEventNames) {
|
|
5
|
-
LifecycleEventNames["WillEnterForeground"] = "willEnterForeground";
|
|
6
|
-
LifecycleEventNames["WillEnterBackground"] = "willEnterBackground";
|
|
7
|
-
})(LifecycleEventNames || (LifecycleEventNames = {}));
|
|
8
|
-
exports.default = LifecycleEventNames;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var LifecycleEventNames;
|
|
4
|
+
(function (LifecycleEventNames) {
|
|
5
|
+
LifecycleEventNames["WillEnterForeground"] = "willEnterForeground";
|
|
6
|
+
LifecycleEventNames["WillEnterBackground"] = "willEnterBackground";
|
|
7
|
+
})(LifecycleEventNames || (LifecycleEventNames = {}));
|
|
8
|
+
exports.default = LifecycleEventNames;
|