minigame-std
    Preparing search index...

    Function addShowListener

    • 添加游戏回到前台事件监听器。

      Parameters

      • listener: (ev?: OnShowListenerResult) => void

        游戏回到前台事件的回调函数。Web 平台无启动参数,回调参数为 undefined

      Returns () => void

      返回一个函数,调用该函数可以移除监听器。

      2.2.0

      const removeListener = addShowListener((options) => {
      console.log('游戏回到前台:', options?.scene);
      });

      // 移除监听器
      removeListener();