TimeRangeEvent
A TimeRangeEvent uses a TimeRange to specify the range over which the event occurs and maps that to a data object representing some measurements or metrics during that time range.
You supply the timerange as a TimeRange object.
The data is also specified during construction and me be either: 1) a Javascript object or simple type 2) an Immutable.Map. 3) Simple measurement
If an Javascript object is provided it will be stored internally as an Immutable Map. If the data provided is some other simple type (such as an integer) then it will be equivalent to supplying an object of {value: data}. Data may also be undefined.
To get the data out of an TimeRangeEvent instance use data()
.
It will return an Immutable.Map. Alternatively you can call toJSON()
to return a Javascript object representation of the data, while
toString()
will serialize the event to a string.
Constructor Summary
Public Constructor | ||
public |
constructor(arg1: *, arg2: *) The creation of an TimeRangeEvent is done by combining two parts: |
Method Summary
Public Methods | ||
public |
begin(): Data The begin time of this Event |
|
public |
data(): Immutable.Map Access the event data |
|
public |
end(): Data The end time of this Event |
|
public |
Get specific data out of the Event |
|
public |
humanizeDuration(): * |
|
public |
The TimeRange of this data |
|
public |
The TimeRange of this data, in Local time, as a string. |
|
public |
The TimeRange of this data, in UTC, as a string. |
|
public |
timestamp(): Data Alias for the begin() time. |
|
public |
toJSON(): * |
|
public |
toString(): * |
Public Constructors
public constructor(arg1: *, arg2: *) source
The creation of an TimeRangeEvent is done by combining two parts: the timerange and the data.
To construct you specify a TimeRange, along with the data.
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 timerangeAsLocalString(): string source
The TimeRange of this data, in Local time, as a string.
public timestamp(): Data source
Alias for the begin() time.
Return:
Data | Time representing this Event |