How to use the @tarojs/taro-h5.eventCenter function in @tarojs/taro-h5

To help you get started, we’ve selected a few @tarojs/taro-h5 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NervJS / taro / packages / taro-router / src / history / createHistory.ts View on Github external
// 记录最后一个location,浏览器前进后退按钮用
    lastLocation = {...nextState.location}

    stateKey = Number(nextState.location.state!.key)

    serialize()

    history.length = globalHistory.length
    const params = {
      fromLocation,
      toLocation: history.location,
      action: history.action
    }

    Taro._$router = history.location
    Taro.eventCenter.trigger('__taroRouterChange', {...params})
    transitionManager.notifyListeners({...params})
  }
github NervJS / taro / packages / taro-components / src / components / pull-down-refresh / index.js View on Github external
this.listeners.forEach(([evtName, callback]) => {
      Taro.eventCenter.off(evtName, callback)
    })
  }
github NervJS / taro / packages / taro-components / src / components / pull-down-refresh / index.js View on Github external
this.listeners.forEach(([evtName, callback]) => {
      Taro.eventCenter.on(evtName, callback)
    })
  }
github NervJS / taro / packages / taro-components / src / components / tabbar / index.js View on Github external
removeEvent () {
    Taro.eventCenter.off('__taroRouterChange', this.routerChangeHandler)
    Taro.eventCenter.off('__taroSwitchTab', this.switchTabHandler)
    Taro.eventCenter.off('__taroSetTabBarBadge', this.setTabBarBadgeHandler)
    Taro.eventCenter.off('__taroRemoveTabBarBadge', this.removeTabBarBadgeHandler)
    Taro.eventCenter.off('__taroShowTabBarRedDotHandler', this.showTabBarRedDotHandler)
    Taro.eventCenter.off('__taroHideTabBarRedDotHandler', this.hideTabBarRedDotHandler)
    Taro.eventCenter.off('__taroShowTabBarHandler', this.showTabBarHandler)
    Taro.eventCenter.off('__taroHideTabBarHandler', this.hideTabBarHandler)
  }
github NervJS / taro / packages / taro-components / src / components / tabbar / index.js View on Github external
removeEvent () {
    Taro.eventCenter.off('__taroRouterChange', this.routerChangeHandler)
    Taro.eventCenter.off('__taroSwitchTab', this.switchTabHandler)
    Taro.eventCenter.off('__taroSetTabBarBadge', this.setTabBarBadgeHandler)
    Taro.eventCenter.off('__taroRemoveTabBarBadge', this.removeTabBarBadgeHandler)
    Taro.eventCenter.off('__taroShowTabBarRedDotHandler', this.showTabBarRedDotHandler)
    Taro.eventCenter.off('__taroHideTabBarRedDotHandler', this.hideTabBarRedDotHandler)
    Taro.eventCenter.off('__taroShowTabBarHandler', this.showTabBarHandler)
    Taro.eventCenter.off('__taroHideTabBarHandler', this.hideTabBarHandler)
  }