How to use the overmind.EventType.COMPONENT_ADD function in overmind

To help you get started, we’ve selected a few overmind 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 cerebral / overmind / packages / node_modules / overmind-components / src / component.ts View on Github external
}
    if (!(name in nextComponentInstanceId)) {
      nextComponentInstanceId[name] = 0
    }

    nextComponentInstanceId[name] = nextId++

    const componentId = nextComponentId
    const componentInstanceId = nextComponentInstanceId[name]

    Object.assign(component, {
      componentId,
      componentInstanceId,
    })

    getApp().eventHub.emitAsync(EventType.COMPONENT_ADD, {
      componentId,
      componentInstanceId,
      name,
      paths: Array.from(tree.pathDependencies) as any,
    })
  } catch (error) {
    console.log(error.message)
  }
}
github codesandbox / codesandbox-client / packages / app / src / app / overmind / createConnect.ts View on Github external
componentDidMount() {
      this.overmind.eventHub.emitAsync(EventType.COMPONENT_ADD, {
        componentId: populatedComponent.__componentId,
        componentInstanceId: this.componentInstanceId,
        name,
        paths: Array.from(this.tree.pathDependencies) as any,
      });
    }
    componentDidUpdate() {
github cerebral / overmind / packages / node_modules / overmind-vue / src / index.ts View on Github external
mounted(this: any) {
            if (overmind.mode.mode === MODE_SSR) return

            overmind.eventHub.emitAsync(EventType.COMPONENT_ADD, {
              componentId,
              componentInstanceId: this[OVERMIND].componentInstanceId,
              name: this.$options.name || '',
              paths: Array.from(this[OVERMIND].tree.pathDependencies) as any,
            })
          },
          updated(this: any) {
github cerebral / overmind / packages / node_modules / overmind-angular / src / directive.ts View on Github external
;(window['__zone_symbol__setTimeout'] || setTimeout)(() => {
      this.overmind.eventHub.emitAsync(EventType.COMPONENT_ADD, {
        componentId: this.componentDetails.componentId,
        componentInstanceId: this.componentDetails.componentInstanceId,
        name: this.componentDetails.name,
        paths: Array.from(this.tree.pathDependencies) as any,
      })
    })
  }
github cerebral / overmind / packages / node_modules / overmind-react / src / index.ts View on Github external
componentDidMount() {
          this.overmind.eventHub.emitAsync(EventType.COMPONENT_ADD, {
            componentId: populatedComponent.__componentId,
            componentInstanceId: this.componentInstanceId,
            name,
            paths: Array.from(this.tree.pathDependencies) as any,
          })
        }
        componentDidUpdate() {