Home Identifier Source
import {TimeRangeEvent} from '@esnet/pond/src/event.js'
public class | source

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(key: string): Object

Get specific data out of the Event

public
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:

NameTypeAttributeDescription
arg1 *
arg2 *

Public Methods

public begin(): Data source

The begin time of this Event

Return:

Data

Begin time

public data(): Immutable.Map source

Access the event data

Return:

Immutable.Map

Data for the Event

public end(): Data source

The end time of this Event

Return:

Data

End time

public get(key: string): Object source

Get specific data out of the Event

Params:

NameTypeAttributeDescription
key string

Key to lookup, or "value" if not specified.

Return:

Object

The data associated with this key

public humanizeDuration(): * source

Return:

*

public timerange(): TimeRange source

The TimeRange of this data

Return:

TimeRange

TimeRange of this data.

public timerangeAsLocalString(): string source

The TimeRange of this data, in Local time, as a string.

Return:

string

TimeRange of this data.

public timerangeAsUTCString(): string source

The TimeRange of this data, in UTC, as a string.

Return:

string

TimeRange of this data.

public timestamp(): Data source

Alias for the begin() time.

Return:

Data

Time representing this Event

public toJSON(): * source

Return:

*

public toString(): * source

Return:

*