38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
import { isInSSRComponentSetup, injectHook, getCurrentInstance } from "vue";
|
|
const ON_SHOW = "onShow";
|
|
const ON_HIDE = "onHide";
|
|
const ON_LOAD = "onLoad";
|
|
const ON_READY = "onReady";
|
|
const ON_UNLOAD = "onUnload";
|
|
function requireNativePlugin(name) {
|
|
return weex.requireModule(name);
|
|
}
|
|
function formatAppLog(type, filename, ...args) {
|
|
if (uni.__log__) {
|
|
uni.__log__(type, filename, ...args);
|
|
} else {
|
|
console[type].apply(console, [...args, filename]);
|
|
}
|
|
}
|
|
function resolveEasycom(component, easycom) {
|
|
return typeof component === "string" ? easycom : component;
|
|
}
|
|
const createHook = (lifecycle) => (hook, target = getCurrentInstance()) => {
|
|
!isInSSRComponentSetup && injectHook(lifecycle, hook, target);
|
|
};
|
|
const onShow = /* @__PURE__ */ createHook(ON_SHOW);
|
|
const onHide = /* @__PURE__ */ createHook(ON_HIDE);
|
|
const onLoad = /* @__PURE__ */ createHook(ON_LOAD);
|
|
const onReady = /* @__PURE__ */ createHook(ON_READY);
|
|
const onUnload = /* @__PURE__ */ createHook(ON_UNLOAD);
|
|
export {
|
|
resolveEasycom as a,
|
|
onReady as b,
|
|
onShow as c,
|
|
onHide as d,
|
|
onUnload as e,
|
|
formatAppLog as f,
|
|
onLoad as o,
|
|
requireNativePlugin as r
|
|
};
|