@zimi/remote 0.2.1-alpha.3 → 0.2.1-alpha.4
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/dist/adaptor.d.ts +32 -0
- package/dist/adaptor.js +2 -0
- package/dist/adaptor.js.map +1 -0
- package/package.json +1 -1
- package/src/{adaptor.d.ts → adaptor.ts} +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface AdaptorPackageData {
|
|
2
|
+
/**
|
|
3
|
+
* 自身设备 id,应确保唯一性(对方能凭借该 deviceId 找到该设备)
|
|
4
|
+
*/
|
|
5
|
+
deviceId: string;
|
|
6
|
+
/**
|
|
7
|
+
* 对方的设备 id
|
|
8
|
+
*/
|
|
9
|
+
targetDeviceId: string;
|
|
10
|
+
/**
|
|
11
|
+
* 远程调用的对方的方法名
|
|
12
|
+
*/
|
|
13
|
+
name: string;
|
|
14
|
+
data: unknown;
|
|
15
|
+
/**
|
|
16
|
+
* 所需回调的方法名(如果需要回调的话)
|
|
17
|
+
*/
|
|
18
|
+
callbackName?: string;
|
|
19
|
+
}
|
|
20
|
+
type Func<D = unknown, R = unknown> = (data: D) => R;
|
|
21
|
+
export type AdaptorCallback = Func<AdaptorPackageData, void>;
|
|
22
|
+
export interface Adaptor {
|
|
23
|
+
every: (callback: AdaptorCallback) => void;
|
|
24
|
+
/**
|
|
25
|
+
* off 用于移除 once 注册的事件,当事件超时后,需要主动 off
|
|
26
|
+
*/
|
|
27
|
+
off: (name: string, callback: AdaptorCallback) => void;
|
|
28
|
+
on: (name: string, callback: AdaptorCallback) => void;
|
|
29
|
+
once: (name: string, callback: AdaptorCallback) => void;
|
|
30
|
+
emit: (data: AdaptorPackageData) => void;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
package/dist/adaptor.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../src/adaptor.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ export interface AdaptorPackageData {
|
|
|
20
20
|
|
|
21
21
|
type Func<D = unknown, R = unknown> = (data: D) => R
|
|
22
22
|
|
|
23
|
-
type AdaptorCallback = Func<AdaptorPackageData, void>
|
|
23
|
+
export type AdaptorCallback = Func<AdaptorPackageData, void>
|
|
24
24
|
|
|
25
25
|
export interface Adaptor {
|
|
26
26
|
every: (callback: AdaptorCallback) => void
|