How to use the @tarojs/mobx-common.isUsingStaticRendering function in @tarojs/mobx-common

To help you get started, we’ve selected a few @tarojs/mobx-common 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-mobx-h5 / src / observer.js View on Github external
export function observer (component) {
  if (isUsingStaticRendering()) {
    return component
  }

  if (component.isMobxInjector === true) {
    console.warn(
      "Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"
    )
  }

  const target = component.prototype

  const originComponentWillUnmount = target.componentWillUnmount
  target.componentWillUnmount = function () {
    if (this._reaction) {
      this._reaction.dispose()
    }
github NervJS / taro / packages / taro-mobx / src / observer.js View on Github external
export function observer (component) {
  if (isUsingStaticRendering()) {
    return component
  }

  if (component.isMobxInjector === true) {
    console.warn(
      "Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"
    )
  }

  const target = component.prototype
  const originConstructor = target._constructor
  target._constructor = function () {
    if (this.$scope) {
      const initialName = this.displayName || this.name
      this._reaction = new Reaction(`${initialName}_${Date.now()}`, () => {
        this.componentWillReact && this.componentWillReact()