🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@mtgoo/ctool

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mtgoo/ctool - npm Package Compare versions

Comparing version
0.0.22
to
0.0.23
+23
-17
dist/ctool.es.js

@@ -817,5 +817,6 @@ /**

/**
* @example 创建 client
* @example
* ```
* let ins: TinyRpcClient =new TinyRpcClient("ws://localhost:3030") as any;
* //创建 client
* let ins: RpcClient =new RpcClient("ws://localhost:3030") as any;
* ins.on("connect", () => {

@@ -831,3 +832,3 @@ * //调用远程方法

*/
class TinyRpcClient extends TinyWsClient {
class RpcClient extends TinyWsClient {
constructor(url, opts = {}) {

@@ -894,8 +895,10 @@ var _a, _b;

/**
* @example 创建server
* @example
* ```
* TinyWsServer.create({ port: 8080 });
* //创建server
* RpcServer.create({ port: 8080 });
* ```
* @example 使用 http/https server
* @example
* ```
* //使用 http/https server
* const fs = require('fs');

@@ -910,7 +913,7 @@ * const https = require('https');

*
* TinyWsServer.create({server});
* RpcServer.create({server});
* ```
* @param options
*/
class TinyRpcServer extends EventEmitter {
class RpcServer extends EventEmitter {
constructor(options) {

@@ -956,3 +959,3 @@ super();

static create(options) {
return new TinyRpcServer(options);
return new RpcServer(options);
}

@@ -982,5 +985,6 @@ }

*
* @example 创建server
* @example
*
* ```
* //创建server
* var server = TinyRpcServer.create({ port: 9191 });

@@ -992,4 +996,5 @@ * server.registerMethod("add", (data: any[]) => {

*
* @example 创建 client
* @example
* ```
* //创建 client
* let ins: TinyRpcClient =new TinyRpcClient("ws://localhost:3030") as any;

@@ -1007,8 +1012,9 @@ * ins.on("connect", () => {

*/
var TinyRpc;
(function (TinyRpc) {
TinyRpc.Client = TinyRpcClient;
TinyRpc.Server = TinyRpcServer;
})(TinyRpc || (TinyRpc = {}));
var tinyRpc = /*#__PURE__*/Object.freeze({
__proto__: null,
RpcClient: RpcClient,
RpcServer: RpcServer
});
/**

@@ -1432,3 +1438,3 @@ * 复用promise

export { DebuffAction, EventEmitter, EventTarget, ExposedPromise, Interceptor, ObjectPool, Observable, ObservableData, PersistPromise, RecurveObservable, Timer, tinyHFSM as TinyHFSM, TinyRpc, TinyRpcClient, TinyRpcServer, TinyWsClient, UUID, WSEventEnum, Watch, executePromisesByBatch, retryPromise, wrapPromise };
export { DebuffAction, EventEmitter, EventTarget, ExposedPromise, Interceptor, ObjectPool, Observable, ObservableData, PersistPromise, RecurveObservable, Timer, tinyHFSM as TinyHFSM, tinyRpc as TinyRpc, TinyWsClient, UUID, WSEventEnum, Watch, executePromisesByBatch, retryPromise, wrapPromise };
//# sourceMappingURL=ctool.es.js.map

@@ -819,5 +819,6 @@ (function (global, factory) {

/**
* @example 创建 client
* @example
* ```
* let ins: TinyRpcClient =new TinyRpcClient("ws://localhost:3030") as any;
* //创建 client
* let ins: RpcClient =new RpcClient("ws://localhost:3030") as any;
* ins.on("connect", () => {

@@ -833,3 +834,3 @@ * //调用远程方法

*/
class TinyRpcClient extends TinyWsClient {
class RpcClient extends TinyWsClient {
constructor(url, opts = {}) {

@@ -896,8 +897,10 @@ var _a, _b;

/**
* @example 创建server
* @example
* ```
* TinyWsServer.create({ port: 8080 });
* //创建server
* RpcServer.create({ port: 8080 });
* ```
* @example 使用 http/https server
* @example
* ```
* //使用 http/https server
* const fs = require('fs');

@@ -912,7 +915,7 @@ * const https = require('https');

*
* TinyWsServer.create({server});
* RpcServer.create({server});
* ```
* @param options
*/
class TinyRpcServer extends EventEmitter {
class RpcServer extends EventEmitter {
constructor(options) {

@@ -958,10 +961,59 @@ super();

static create(options) {
return new TinyRpcServer(options);
return new RpcServer(options);
}
}
(function (TinyRpc) {
TinyRpc.Client = TinyRpcClient;
TinyRpc.Server = TinyRpcServer;
})(exports.TinyRpc || (exports.TinyRpc = {}));
/**
* 基于tinyWs的简易rpc实现
*
*@description <br/>
* <br/>
*
* 发送消息结构:
* ```
* {
* id: "消息id",
* method: "消息名",
* params: "消息参数"
* }
* ```
* 返回消息结构:
* ```
* {
* id:"消息id",
* result:"方法结果"
* }
* ```
*
* @example
*
* ```
* //创建server
* var server = TinyRpcServer.create({ port: 9191 });
* server.registerMethod("add", (data: any[]) => {
* return data[0] + data[1];
* })
* ```
*
* @example
* ```
* //创建 client
* let ins: TinyRpcClient =new TinyRpcClient("ws://localhost:3030") as any;
* ins.on("connect", () => {
* //调用远程方法
* ins.callMethod("add", [1, 2])
* .then(result => {
* console.log("result equal 3", result);
* })
* })
* ```
*
*
*/
var tinyRpc = /*#__PURE__*/Object.freeze({
__proto__: null,
RpcClient: RpcClient,
RpcServer: RpcServer
});
/**

@@ -1397,4 +1449,3 @@ * 复用promise

exports.TinyHFSM = tinyHFSM;
exports.TinyRpcClient = TinyRpcClient;
exports.TinyRpcServer = TinyRpcServer;
exports.TinyRpc = tinyRpc;
exports.TinyWsClient = TinyWsClient;

@@ -1401,0 +1452,0 @@ exports.UUID = UUID;

@@ -10,3 +10,3 @@ export * from "./debuffAction";

export * from "./tinyWs";
export * from './tinyRpc';
export * as TinyRpc from './tinyRpc';
export * from './persistPromise';

@@ -13,0 +13,0 @@ export * from './objectPool';

import { IwsOpts, TinyWsClient } from "./tinyWs";
import { EventEmitter } from "./eventEmitter";
/**
* @example 创建 client
* @example
* ```
* let ins: TinyRpcClient =new TinyRpcClient("ws://localhost:3030") as any;
* //创建 client
* let ins: RpcClient =new RpcClient("ws://localhost:3030") as any;
* ins.on("connect", () => {

@@ -17,3 +18,3 @@ * //调用远程方法

*/
export declare class TinyRpcClient extends TinyWsClient {
export declare class RpcClient extends TinyWsClient {
protected opts: IRpcClientOptions;

@@ -41,8 +42,10 @@ constructor(url: string, opts?: IRpcClientOptions);

/**
* @example 创建server
* @example
* ```
* TinyWsServer.create({ port: 8080 });
* //创建server
* RpcServer.create({ port: 8080 });
* ```
* @example 使用 http/https server
* @example
* ```
* //使用 http/https server
* const fs = require('fs');

@@ -57,11 +60,11 @@ * const https = require('https');

*
* TinyWsServer.create({server});
* RpcServer.create({server});
* ```
* @param options
*/
export declare class TinyRpcServer extends EventEmitter {
export declare class RpcServer extends EventEmitter {
static create(options: {
port?: number;
server?: any;
}): TinyRpcServer;
}): RpcServer;
private constructor();

@@ -95,5 +98,6 @@ private _handleMessage;

*
* @example 创建server
* @example
*
* ```
* //创建server
* var server = TinyRpcServer.create({ port: 9191 });

@@ -105,4 +109,5 @@ * server.registerMethod("add", (data: any[]) => {

*
* @example 创建 client
* @example
* ```
* //创建 client
* let ins: TinyRpcClient =new TinyRpcClient("ws://localhost:3030") as any;

@@ -119,6 +124,2 @@ * ins.on("connect", () => {

*
*/
export declare namespace TinyRpc {
const Client: typeof TinyRpcClient;
const Server: typeof TinyRpcServer;
}
*/
{
"name": "@mtgoo/ctool",
"version": "0.0.22",
"version": "0.0.23",
"main": "./dist/ctool.js",

@@ -5,0 +5,0 @@ "module": "./dist/ctool.es.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display