jcc_rpc
Version:
rpc api of jcc
88 lines • 3.08 kB
JavaScript
;
/**
* MIT License
* Copyright (c) 2018 JCC Dex
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* @author https://github.com/GinMu
*/
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var base_1 = require("./base");
exports.JcBase = base_1.default;
var config_1 = require("./config");
exports.JcConfig = config_1.default;
var explorer_1 = require("./explorer");
exports.JcExplorer = explorer_1.default;
var info_1 = require("./info");
exports.JcInfo = info_1.default;
var node_rpc_1 = require("./node_rpc");
exports.JcNodeRpc = node_rpc_1.default;
var subscribe_1 = require("./subscribe");
exports.SubscribeTask = subscribe_1.default;
exports.Factory = function (C) {
var inst = null;
/**
* create singleton
*
* @param {*} args
* @returns {T}
*/
var init = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return inst || (inst = new (C.bind.apply(C, __spreadArrays([void 0], args)))());
};
/**
* get singleton
*
* @returns {(T | null)}
*/
var get = function () {
return inst;
};
/**
* destroy singleton
*
*/
var destroy = function () {
inst = null;
};
return {
destroy: destroy,
init: init,
get: get
};
};
exports.ConfigFactory = exports.Factory(config_1.default);
exports.InfoFactory = exports.Factory(info_1.default);
exports.ExplorerFactory = exports.Factory(explorer_1.default);
exports.NodeRpcFactory = exports.Factory(node_rpc_1.default);
exports.SubscribeFactory = exports.Factory(subscribe_1.default);
//# sourceMappingURL=index.js.map