Skip to content

ciqtek/worker-ws-client

Repository files navigation

worker-ws-client

🚄 使用教程

安装

  npm i install worker-ws-client --save-dev or yarn add worker-ws-client --save-dev

使用

import WorkerWsClient from "worker-ws-client"


class WsClient extends WorkerWsClient {
  constructor(){
    super()
    this._worker.addEventListener('message', e => {
      
    })
  }
}

📖 文档

WsWorkerClient

new WsWorkerClient()

构建WsWorkerClient实例

wsWorkerClient.postMessage(message, transfer)

通过worker 发送消息

Param Type Description
message Object {type:string,args:Array}
transfer *

wsWorkerClient.send(params, asyncCallback)

Param Type Description
params Object 消息类型加参数数据
asyncCallback Fucntion 存储回调方法

wsWorkerClient.init(websocketUrl)

初始化websocket

Param Type Description
websocketUrl String websocket地址

About

worker for websocket client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published