Core Concepts
/

Events

VoiceCode keeps track of everything that is happening via events. If your code needs to react to certain events, it can "subscribe" to the relevant event name. Subscription callbacks are called sequentially/synchronously in order of subscription. You can find events by either going through the codebase or toggling the 'debug' icon on the log page of main window. All of the methods in the following examples belong to the Events object and to have been put on the global scope for convenience.

Subscribing

unboundmusic/9049671f44848a01262d138ffc32bfb0

Unsubscribing

unboundmusic/22815d8293fa0d863d67df4f8f270109

Event types

We use different convenience methods for emitting various event types:

  • `emit` => event ^message normally hidden from UI^
  • `log` => event  ^green message^
  • `notify` => event  ^purple message, system notification^
  • `warning` => event , ^yellow message^
  • `error` => event , ^red message^
  • `debug` => no event, ^black message^
  • `mutate` => special event, ^orange message^

Mutation event

A reducer. Subscribers can return an altered version of the passed argument. This is used for when the logic of a function needs the ability to be altered by other packages or code residing elsewhere.

unboundmusic/70a152e0d3569311ff7f3689254e55bc