jcc_rpc
Version:
rpc api of jcc
95 lines • 3.7 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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SubscribeFactory = exports.NodeRpcFactory = exports.ExplorerFactory = exports.InfoFactory = exports.ConfigFactory = exports.Factory = exports.SubscribeTask = exports.JcNodeRpc = exports.JcInfo = exports.JcExplorer = exports.JcConfig = exports.JcBase = void 0;
var base_1 = __importDefault(require("./base"));
exports.JcBase = base_1.default;
var config_1 = __importDefault(require("./config"));
exports.JcConfig = config_1.default;
var explorer_1 = __importDefault(require("./explorer"));
exports.JcExplorer = explorer_1.default;
var info_1 = __importDefault(require("./info"));
exports.JcInfo = info_1.default;
var node_rpc_1 = __importDefault(require("./node_rpc"));
exports.JcNodeRpc = node_rpc_1.default;
var subscribe_1 = __importDefault(require("./subscribe"));
exports.SubscribeTask = subscribe_1.default;
var 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, __spreadArray([void 0], args, false)))());
};
/**
* 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.Factory = Factory;
exports.ConfigFactory = (0, exports.Factory)(config_1.default);
exports.InfoFactory = (0, exports.Factory)(info_1.default);
exports.ExplorerFactory = (0, exports.Factory)(explorer_1.default);
exports.NodeRpcFactory = (0, exports.Factory)(node_rpc_1.default);
exports.SubscribeFactory = (0, exports.Factory)(subscribe_1.default);
//# sourceMappingURL=index.js.map