0.3.2 • Published 3 years ago

jcc_rpc v0.3.2

Weekly downloads
6
License
MIT
Repository
github
Last release
3 years ago

jcc_rpc

npm Build Status Coverage Status npm downloads

Installation

npm install jcc_rpc

Docs

see docs

SubscribeTask

Added SubscribeTask class since v0.2.3.

// By requesting config as an example

const { SubscribeFactory, ConfigFactory } = require("jcc_rpc");

const configInst = ConfigFactory.init(["https://jccdex.cn"]);

const subscribeInst = SubscribeFactory.init();

// task name
const TASK_NAME = "pollingConfig";
// task function
const task = configInst.getConfig.bind(configInst);
// whether polling, default true
const polling = true;
// polling interval, default 5000(ms)
const timer = 10000;

const callback = (err, res) => {
  console.log(err);
  console.log(res);
};

subscribeInst
  // register task
  .register(TASK_NAME, task, polling, timer)
  // watch task
  .on(TASK_NAME, callback)
  // start task
  .start(TASK_NAME)
  // stop polling given task
  .stopPolling(TASK_NAME)
  // remove given task
  .removeTask(TASK_NAME)
  // remove all tasks
  .removeAll()
  // stop polling all tasks
  .stopAll()
  // cancel watch
  .off(TASK_NAME, callback);
0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

4 years ago

0.2.9

4 years ago

0.2.8

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago