mirror of
https://github.com/koush/scrypted.git
synced 2026-02-09 16:52:18 +00:00
sdk: mixin events
This commit is contained in:
3
sdk/index.d.ts
vendored
3
sdk/index.d.ts
vendored
@@ -65,7 +65,8 @@ export class ScryptedDeviceBase implements DeviceState {
|
||||
|
||||
|
||||
export class MixinDeviceBase<T> implements DeviceState {
|
||||
constructor(mixinDevice: T, mixinDeviceInterfaces: ScryptedInterface[], mixinDeviceState: { [key: string]: any }, providerNativeId: string);
|
||||
constructor(mixinDevice: T, mixinDeviceInterfaces: ScryptedInterface[], mixinDeviceState: { [key: string]: any }, mixinProviderNativeId: string);
|
||||
mixinProviderNativeId: string;
|
||||
mixinDevice: ScryptedDevice & T;
|
||||
mixinDeviceInterfaces: ScryptedInterface[];
|
||||
console: Console;
|
||||
|
||||
@@ -40,17 +40,17 @@ class ScryptedDeviceBase {
|
||||
}
|
||||
|
||||
class MixinDeviceBase {
|
||||
constructor(mixinDevice, mixinDeviceInterfaces, mixinDeviceState, providerNativeId) {
|
||||
constructor(mixinDevice, mixinDeviceInterfaces, mixinDeviceState, mixinProviderNativeId) {
|
||||
this.mixinDevice = mixinDevice;
|
||||
this.mixinDevice = mixinDevice;
|
||||
this.mixinDeviceInterfaces = mixinDeviceInterfaces;
|
||||
this._deviceState = mixinDeviceState;
|
||||
this.providerNativeId = providerNativeId;
|
||||
this.mixinProviderNativeId = mixinProviderNativeId;
|
||||
}
|
||||
|
||||
get storage() {
|
||||
if (!this._storage) {
|
||||
this._storage = deviceManager.getMixinStorage(this.id, this.providerNativeId);
|
||||
this._storage = deviceManager.getMixinStorage(this.id, this.mixinProviderNativeId);
|
||||
}
|
||||
return this._storage;
|
||||
}
|
||||
|
||||
7
sdk/types.d.ts
vendored
7
sdk/types.d.ts
vendored
@@ -709,9 +709,14 @@ export interface DeviceManager {
|
||||
* @param id The id of the device being mixined.
|
||||
* @param nativeId The nativeId of the MixinProvider.
|
||||
*/
|
||||
getMixinStorage(id: string, nativeId?: string): Storage;
|
||||
getMixinStorage(id: string, nativeId: string): Storage;
|
||||
|
||||
/**
|
||||
* Fire an event for a mixin provided by this plugin.
|
||||
*/
|
||||
onMixinEvent(id: string, nativeId: string, eventInterface: string, eventData: any): Promise<void>;
|
||||
|
||||
/**
|
||||
* Get the per device Storage object.
|
||||
*/
|
||||
getDeviceStorage(nativeId: string): Storage;
|
||||
|
||||
Reference in New Issue
Block a user