Event
A generic event
This represents a data object at a single timestamp, supplied at initialization.
The timestamp may be a javascript Date object or a Moment, but is stored internally as ms since UNIX epoch.
The data may be any type.
Asking the Event object for the timestamp returns an integer copy of the number of ms since the UNIX epoch. There's no method on the Event object to mutate the Event timestamp after it is created.
Constructor Summary
Public Constructor | ||
public |
constructor(arg1: *, arg2: *) The creation of an Event is done by combining two parts: |
Method Summary
Public Methods | ||
public |
data(): Immutable.Map Access the event data |
|
public |
Get specific data out of the Event |
|
public |
stringify(): * |
|
public |
The timestamp of this data |
|
public |
The timestamp of this data, in Local time, as a string. |
|
public |
The timestamp of this data, in UTC time, as a string. |
|
public |
Returns the Event as a JSON object, essentially: |
|
public |
Retruns the Event as a string, useful for serialization. |
Public Constructors
public constructor(arg1: *, arg2: *) source
The creation of an Event is done by combining two parts: the timestamp (or time range, or Index...) and the data.
To construct you specify the timestamp as either:
- Javascript Date object
- a Moment, or
- ms timestamp: the number of ms since the UNIX epoch
To specify the data you can supply either:
- a Javascript object containing key values pairs
- an Immutable.Map, or
- a simple type such as an integer. In the case of the simple type
this is a shorthand for supplying {"value": v}.
Params:
Name | Type | Attribute | Description |
arg1 | * | ||
arg2 | * |
Public Methods
public get(key: string): Object source
Get specific data out of the Event
Params:
Name | Type | Attribute | Description |
key | string | Key to lookup, or "value" if not specified. |
public timestampAsLocalString(): string source
The timestamp of this data, in Local time, as a string.