UNPKG

mtl-js-sdk

Version:

165 lines (130 loc) 4.43 kB
"use strict"; define(function () { function setStatusBar(obj) { mtlBridge.call("statusbar.setStatusBar", JSON.stringify(obj), obj.callback); } function getImei(obj) { mtlBridge.call("device.getImei", JSON.stringify(obj), obj.callback); } function getImsi(obj) { mtlBridge.call("device.getImsi", JSON.stringify(obj), obj.callback); } function getDeviceModel(obj) { mtlBridge.call("device.getDeviceModel", JSON.stringify(obj), obj.callback); } function getVendor(obj) { mtlBridge.call("device.getVendor", JSON.stringify(obj), obj.callback); } function dail(obj) { mtlBridge.call("device.dail", JSON.stringify(obj), obj.callback); } function getOSVersion(obj) { mtlBridge.call("device.getOSVersion", JSON.stringify(obj), obj.callback); } function getUUID(obj) { mtlBridge.call("device.getUUID", JSON.stringify(obj), obj.callback); } function lockOrientation(obj) { mtlBridge.call("device.lockOrientation", JSON.stringify(obj), obj.callback); } function unlockOrientation(obj) { mtlBridge.call("device.unlockOrientation", JSON.stringify(obj), obj.callback); } function getAppVersion(obj) { mtlBridge.call("device.getAppVersion", JSON.stringify(obj), obj.callback); } function quit(obj) { mtlBridge.call("system.quit", JSON.stringify(obj), obj.callback); } function getTerminalType(object) { mtlBridge.call('device.getTerminalType', JSON.stringify(object), object.callback); } function isLogs(obj) { mtlBridge.call("system.isLogs", JSON.stringify(obj), obj.callback); } var _originFn = null; function setLogs(obj) { var log = obj.log; if (log === true && _originFn) { window.console.log = _originFn; _originFn = null; } else if (log === false) { _originFn = window.console.log; window.console.log = function () {}; } mtlBridge.call("system.setLogs", JSON.stringify(obj), obj.callback); } function setAppBadge(obj) { mtlBridge.call("system.setAppBadge", JSON.stringify(obj), obj.callback); } function removeAppBadge(obj) { mtlBridge.call("system.removeAppBadge", JSON.stringify(obj), obj.callback); } function confirm(obj) { mtlBridge.call("dialog.confirm", JSON.stringify(obj), obj.callback); } function canBack(obj) { mtlBridge.call("webcontrol.canBack", JSON.stringify(obj), obj.callback); } function back(obj) { mtlBridge.call("webcontrol.back", JSON.stringify(obj), obj.callback); } function deleteWebCache(obj) { mtlBridge.call("webcontrol.deleteWebCache", JSON.stringify(obj), obj.callback); } function openWebview(obj) { mtlBridge.call("webcontrol.openWebview", JSON.stringify(obj), obj.callback); } function addEventListener(obj) { mtlBridge.call("event.addEventListener", JSON.stringify(obj), obj.callback); } function removeEventListener(obj) { mtlBridge.call("event.removeEventListener", JSON.stringify(obj), obj.callback); } function offlineUpdate(obj) { mtlBridge.call("update.offlineUpdate", JSON.stringify(obj), obj.callback); } function openFile(obj) { mtlBridge.call("system.openFile", JSON.stringify(obj), obj.callback); } function getStatusBarHeight(obj) { mtlBridge.call("system.getStatusBarHeight", JSON.stringify(obj), obj.callback); } function upgradeApp(obj) { mtlBridge.call("upgrade.upgradeApp", JSON.stringify(obj), obj.callback); } function upgrade(obj) { mtlBridge.call("upgrade.upgrade", JSON.stringify(obj), obj.callback); } return { setStatusBar: setStatusBar, getStatusBarHeight: getStatusBarHeight, getImei: getImei, getImsi: getImsi, getDeviceModel: getDeviceModel, getVendor: getVendor, dail: dail, getOSVersion: getOSVersion, getUUID: getUUID, lockOrientation: lockOrientation, unlockOrientation: unlockOrientation, quit: quit, isLogs: isLogs, setLogs: setLogs, confirm: confirm, canBack: canBack, back: back, addEventListener: addEventListener, removeEventListener: removeEventListener, offlineUpdate: offlineUpdate, deleteWebCache: deleteWebCache, openWebview: openWebview, setAppBadge: setAppBadge, removeAppBadge: removeAppBadge, openFile: openFile, getAppVersion: getAppVersion, upgradeApp: upgradeApp, upgrade: upgrade, getTerminalType: getTerminalType }; });