|
|
|
@ -1,16 +1,16 @@
|
|
|
|
|
/** |
|
|
|
|
* 会话消息类型枚举 |
|
|
|
|
*/ |
|
|
|
|
export const enum WorkerMessageType { |
|
|
|
|
REQUEST = 'REQUEST', |
|
|
|
|
REPLY = 'REPLY', |
|
|
|
|
} |
|
|
|
|
export const WorkerMessageType = { |
|
|
|
|
REQUEST: 'REQUEST', |
|
|
|
|
REPLY: 'REPLY', |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 会话消息 |
|
|
|
|
*/ |
|
|
|
|
export interface IWorkerMessage { |
|
|
|
|
messageType: WorkerMessageType; |
|
|
|
|
messageType: string; |
|
|
|
|
actionType: string; |
|
|
|
|
sessionId: string; |
|
|
|
|
|
|
|
|
@ -30,3 +30,19 @@ export interface IWorkerController {
|
|
|
|
|
*/ |
|
|
|
|
actionHandler: (message: IWorkerMessage) => Promise<any>; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Worker创建配置 |
|
|
|
|
*/ |
|
|
|
|
export interface IWorkerOptions { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* worker 资源 url |
|
|
|
|
*/ |
|
|
|
|
workerUrl: string; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* worker 实例名称 |
|
|
|
|
*/ |
|
|
|
|
workerName: string; |
|
|
|
|
} |