eapp
Version:
1 lines • 4.05 kB
JavaScript
Ibox("IEappApi",function(e,i,n){var t=Ibox.utils;function c(e,n){t.showWarnLog("iEappApi--抽象调用方法"+e+"未实现-----\x3e",n)}i.OS={ANDROID:"android",IOS:"ios",PC:"pc",UNKNOW:"unKnow"},i.APP={WECHAT:"wechat",DINGTALK:"dingTalk",EAPP:"eapp",SYSBROWSER:"sysBrowser",UNKNOW:"unKnow"},i.getAppType=function(){var e=window.navigator.userAgent;return"MicroMessenger"==e.match(/MicroMessenger/i)?i.APP.WECHAT:-1<e.indexOf("DingTalk")?i.APP.DINGTALK:-1<e.indexOf("Eapp")?i.APP.EAPP:i.APP.UNKNOW},i.getOsType=function(){var e=window.navigator.userAgent;return-1<e.indexOf("Android")||-1<e.indexOf("Adr")?i.OS.ANDROID:e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)?i.OS.IOS:-1<e.indexOf("Windows")?i.OS.PC:i.OS.UNKNOW},i.eventListeners={EappReady:[],EappBack:[],EappNetWorkOnline:[],EappNetWorkOffLine:[],NetWork:[]},i.isReady=function(){return!1},i.curOs=i.getOsType(),i.curApp=i.getAppType(),t.showLog("OsType--\x3e",i.curOs+"; AppType--\x3e"+i.curApp),i.on=function(e,n){"EappBack"==e&&i.curOs!=i.OS.ANDROID||(e in i.eventListeners||(i.eventListeners[e]=[]),this.off(e,n),t.showLog("iEappApi--on--\x3e",e),i.eventListeners[e].push(n))},i.emit=function(e){c("emit",e);var n=i.eventListeners[e];if(n)for(var t=n.length-1;0<=t;t--)n[t]()},i.off=function(e,n){var t=i.eventListeners[e];if(t)for(var o=t.length-1;0<=o;o--)n===t[o]&&(t.splice(o,1),c("删除事件--\x3e"+e,n))},i.clearEvent=function(e){i.eventListeners[e]&&(c("clearEvent",e),i.eventListeners[e]=[])},i.getValueByKey=function(e){return c("getValueByKey",e),""},i.takePhotoFromCamera=function(e,n,t){c("takePhotoFromCamera",""+e)},i.takePhotoFromAlbum=function(e,n,t){c("takePhotoFromAlbum",e)},i.takePhoto=function(e,n,t,o){c("takePhoto",e)},i.takeScan=function(e,n,t){c("takeScan",e)},i.goThirdUrl=function(e){c("goThirdUrl",e)},i.startAPP=function(e,n){c("startAPP",e)},i.goInstallIosPage=function(e){c("goInstallIosPage",e)},i.getPermissionApi=function(){return c("getPermissionApi"),{}},i.checkPermission=function(e,n,t){c("checkPermission",e)},i.requestPermissions=function(e,n,t){c("requestPermissions",e)},i.requestWriteStorage=function(e,n){c("requestWriteStorage")},i.checkAndRequestPermission=function(e,n,t){c("checkAndRequestPermission",e)},i.downloadAndInstallApk=function(e,n){c("downloadAndInstallApk",e)},i.exitApp=function(){c("exitApp")},i.goBack=function(){c("goBack")},i.clearHistory=function(){c("clearHistory")},i.clearCache=function(){c("clearCache")},i.showSplash=function(){c("showSplash")},i.hideSplash=function(){c("hideSplash")},i.titleBarColor=function(e,n){c("titleBarColor",e)},i.titleBarTextColor=function(e){c("titleBarTextColor",e)},i.getNetWorkType=function(){c("getNetWorkType")},i.toSettingApn=function(){c("toSettingApn")},i.getAppVersionNameAndCode=function(e){c("getAppVersionNameAndCode")},i.downloadApk=function(e,n,t){c("downloadApk",n)},i.installApk=function(e){c("installApk",e)},i.downloadFile=function(e,n,t){c("downloadFile",e)},i.getCurrentPosition=function(e){c("getCurrentPosition")},i.refreshPage=function(){window.location.reload()},i.StartVoiceRecognizer=function(e,n,t,o){c("StartVoiceRecognizer")},i.StopVoiceRecognizer=function(){c("StopVoiceRecognizer")},i.CancelVoiceRecognizer=function(){c("CancelVoiceRecognizer")},i.StartSpeack=function(e,n,t){c("StartSpeack",t)},i.PauseSpeack=function(){c("PauseSpeack")},i.ResumeSpeack=function(){c("ResumeSpeack")},i.StopSpeack=function(){c("StopSpeack")},i.HttpRequest=function(e,n,t,o,i,r){c("HttpRequest",t)},i.isAndroid=function(){return i.curOs==i.OS.ANDROID},i.isIos=function(){return i.curOs==i.OS.IOS},i.isInEapp=function(){return i.curApp==i.APP.EAPP},i.isInWechat=function(){return i.curApp==i.APP.WECHAT},i.isInDingTalk=function(){return i.curApp==i.APP.DINGTALK},i.goNewAppPage=function(e,n,t,o){c("goNewAppPage",e)},i.exitAppPage=function(e,n){c("exitAppPage")},i.openIosApp=function(e,n,t){c("openIosApp")},i.getIosAppList=function(){return c("getIosAppList"),{}},i.setValueForApp=function(e,n,t){c("setValueForApp")},i.getValueFromApp=function(e,n,t){c("getValueFromApp")}});