UNPKG

wnjk

Version:

两只蜗牛通用微服务脚本

64 lines (63 loc) 3.07 kB
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; define(["require", "exports", "./implements/pc/pcNative", "./implements/app/mobileNative", "./model/originalInfo", "./utils/wrapStorage", "./utils/jsBridge", "./implements/web/webNative"], function (require, exports, pcNative_1, mobileNative_1, originalInfo_1, wrapStorage_1, jsBridge_1, webNative_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); pcNative_1 = __importDefault(pcNative_1); mobileNative_1 = __importDefault(mobileNative_1); originalInfo_1 = __importStar(originalInfo_1); wrapStorage_1 = __importDefault(wrapStorage_1); jsBridge_1 = __importDefault(jsBridge_1); webNative_1 = __importDefault(webNative_1); var WNJK = (function () { function WNJK() { this.appCode = ""; this.platInfo = new originalInfo_1.default(); this.storage = wrapStorage_1.default; this.jsBridge = jsBridge_1.default; } WNJK.prototype.init = function () { if (this.platInfo.nativeType == originalInfo_1.NativeType.PC) { this.native = new pcNative_1.default(this.appCode); } else if (this.platInfo.nativeType == originalInfo_1.NativeType.Android || this.platInfo.nativeType == originalInfo_1.NativeType.Ios) { this.native = new mobileNative_1.default(this.appCode); } else if (this.platInfo.nativeType == originalInfo_1.NativeType.Web) { this.native = new webNative_1.default(this.appCode); } else { throw new Error("\u6682\u65E0\u6B64\u7C7B\u5E73\u53F0\u4EA4\u4E92\u5B9E\u73B0\uFF1A" + this.platInfo.nativeType); } }; WNJK.createInstance = function (init) { var wnjkObj = new WNJK(); wnjkObj.appCode = init.appCode; wnjkObj.platInfo = init; wnjkObj.init(); return wnjkObj; }; return WNJK; }()); exports.default = WNJK; });