Effector

Effector

  • Docs
  • Try
  • API
  • Blog
  • GitHub

›effector

effector

  • API Reference
  • createEvent
  • Event
  • createEffect
  • Effect
  • createStore
  • Store
  • sample
  • createDomain
  • Domain
  • combine
  • createStoreObject
  • createApi
  • restore
  • forward
  • fromObservable
  • merge
  • split

effector-react

  • API Reference
  • createStoreConsumer
  • createComponent
  • createGate
  • useGate
  • useStore
  • useStoreMap
  • Gate

effector-vue

  • API Reference
  • VueEffector
  • ComponentOptions
  • Vue
Edit

createEvent(name?)

Creates an event

Arguments

  1. name? (string): Event name

Returns

(Event): An intention to change state.

Example

const event = createEvent() // unnamed event
const onMessage = createEvent('message')

const socket = new WebSocket('wss://example.com:4000')
socket.onmessage = msg => onMessage(msg)

const data = onMessage.map(msg => msg.data).map(JSON.parse)

// Handle side effects
data.watch(console.log)
← API ReferenceEvent →
Effector
Docs
Getting StartedAPI Reference
Community
User ShowcaseStack OverflowGitterTwitter
More
GitHubStar
Copyright © 2019 zerobias