"use strict";var __assign=this&&this.__assign||function(){return __assign=Object.assign||function(i){for(var n,e=1,r=arguments.length;e<r;e++){n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(i[t]=n[t])}return i},__assign.apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0});var h5Mobile_1=require("./h5Mobile"),miniAppBridgeReadyPromise,miniAppBridgeInit=function(){return miniAppBridgeReadyPromise||(miniAppBridgeReadyPromise=new Promise(function(i){return setTimeout(i,0)})),miniAppBridgeReadyPromise},miniAppBridge=function(i,n){return miniAppBridgeInit().then(function(){return new Promise(function(e,r){var t=__assign({_apiName:i},n);my.call(i,t,function(i){return h5Mobile_1.handleBridgeResponse(i,e,r)})}).then(function(i){return"function"==typeof n.onSuccess&&n.onSuccess.call(null,i),i},function(i){throw"function"==typeof n.onFail&&n.onFail.call(null,i),i})})},getMiniAppBridge=function(){return miniAppBridgeInit().then(function(){return miniAppBridge})};exports.default=getMiniAppBridge;