PropertyTable.Event (property_table v0.1.0) View Source

Struct sent to subscribers on property changes

  • :table - the table generating this event
  • :property - which property changed
  • :value - the new value
  • :timestamp - the timestamp (System.monotonic_time/0) when the changed happened
  • :previous_value - the previous value (nil if this property is new)
  • :previous_timestamp - the timestamp when the property changed to :previous_value. Use this to calculate how long the property was the previous value.

Link to this section Summary

Functions

Convert event to the old tuple event format

Link to this section Types

Specs

t() :: %PropertyTable.Event{
  previous_timestamp: integer(),
  previous_value: PropertyTable.value(),
  property: PropertyTable.property(),
  table: PropertyTable.table_id(),
  timestamp: integer(),
  value: PropertyTable.value()
}

Link to this section Functions

Specs

to_tuple(t()) ::
  {PropertyTable.table_id(), PropertyTable.property(), PropertyTable.value(),
   PropertyTable.value(), %{new_timestamp: integer(), old_timestamp: integer()}}

Convert event to the old tuple event format

This is only used for backwards compatibility. At some point, it hopefully will be removed.