A change to a collection, broadcast to everyone who has it open.
MyApp.Cardbox.subscribe(collection)
def handle_info({:cardbox, %Cardbox.Event{type: :record_updated, record: record}}, socket)type is one of :record_inserted, :record_updated, :record_moved,
:record_deleted, :field_added, :field_updated, :field_moved,
:field_deleted, :view_saved, :view_deleted, :collection_updated
and :collection_deleted.
A record's event has the record as it is after (as it was, for a
deletion) and, for an update, the keys of the fields that changed. A
field's or a collection's event has the collection as it is after,
with its fields, so a view takes the new fields without reading them
again. actor is the id of who made the change.
Each event is also a :telemetry event, [:cardbox, :change], with the
event in its metadata.
Summary
Types
@type t() :: %Cardbox.Event{ actor: String.t() | nil, changed: [String.t()], collection: Cardbox.Collection.t() | nil, collection_id: integer(), field: Cardbox.Field.t() | nil, record: Cardbox.Record.t() | nil, type: type(), view: Cardbox.View.t() | nil }
@type type() ::
:record_inserted
| :record_updated
| :record_moved
| :record_deleted
| :field_added
| :field_updated
| :field_moved
| :field_deleted
| :view_saved
| :view_deleted
| :collection_updated
| :collection_deleted
Functions
@spec topic(Cardbox.Collection.t() | integer()) :: String.t()
The PubSub topic of a collection's events.