INNER CODE UNIT · JavaScript

getGlobal

Tencent-TDS/KuiklyUI · miniApp-js/src/index.js:16

function getGlobal() {
  if (typeof global !== 'undefined') return global;
  if (typeof globalThis !== 'undefined') return globalThis;
  if (typeof window !== 'undefined') return window;
  return this;
}

/**
 * 获取 Kotlin MiniDocument
 * 注意:必须在运行时获取,不能缓存,因为 Kotlin 模块可能在之后加载
 */
function getKotlinMiniDocument() {
  var g = getGlobal();
  try {
    return g.com.tencent.kuikly.core.render.web.runtime.miniapp.MiniDocument;
  } catch (e) {
    return null;
  }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…