Reference Source
public class | source

Stream

Stream class for BaconJS stream wrapping.

Static Method Summary

Static Public Methods
public static

from_dom_event(arg_dom_elem: string, arg_event_name: string): Stream

Create a Stream instance with a DOM event source stream.

public static

from_emitter_event(arg_emitter: object, arg_event_name: string): Stream

Create a Stream instance with an event emitter source stream.

Constructor Summary

Public Constructor
public

constructor(): nothing

Create a stream.

Member Summary

Public Members
public

counters: {}

public
Private Members
private
private

Method Summary

Public Methods
public

debounce_immediate(arg_milliseconds: integer): *

Debounce immediate.

public

Get counters snapshot and reset values to 0.

public

Get counters snapshot.

public

get_source_stream(): Baconjs.Bus

Get input stream.

public

get_transformed_stream(): Baconjs.Bus

Get output stream.

public

on_error(arg_handler: Function): Function

Subscribe to stream errors.

public

Push a value into the stream.

public

set_transformation(arg_stream_transformation: function): Stream

Set output stream transformation.

public

set_transformed_stream(arg_stream: Baconjs.Bus): Stream

Set output stream.

public

subscribe(arg_handler: Function): Function

Subscribe to stream values.

Static Public Methods

public static from_dom_event(arg_dom_elem: string, arg_event_name: string): Stream source

Create a Stream instance with a DOM event source stream.

Params:

NameTypeAttributeDescription
arg_dom_elem string

DOM element.

arg_event_name string

DOM event name.

Return:

Stream

public static from_emitter_event(arg_emitter: object, arg_event_name: string): Stream source

Create a Stream instance with an event emitter source stream.

Params:

NameTypeAttributeDescription
arg_emitter object

event emitter.

arg_event_name string

event name.

Return:

Stream

Public Constructors

public constructor(): nothing source

Create a stream.

Return:

nothing

Public Members

public counters: {} source

public is_stream: boolean source

Private Members

private _source_stream: * source

private _transformed_stream: * source

Public Methods

public debounce_immediate(arg_milliseconds: integer): * source

Debounce immediate.

Params:

NameTypeAttributeDescription
arg_milliseconds integer

number of milliseconds.

Return:

*

public get_and_reset_counters_snapshot(): * source

Get counters snapshot and reset values to 0.

Return:

*

public get_counters_snapshot(): object source

Get counters snapshot.

Return:

object

counters.

public get_source_stream(): Baconjs.Bus source

Get input stream.

Return:

Baconjs.Bus

public get_transformed_stream(): Baconjs.Bus source

Get output stream.

Return:

Baconjs.Bus

public on_error(arg_handler: Function): Function source

Subscribe to stream errors.

Params:

NameTypeAttributeDescription
arg_handler Function

value handler f(value) => nothing.

Return:

Function

unsubscribe function

public push(): Stream source

Push a value into the stream.

Return:

Stream

this.

public set_transformation(arg_stream_transformation: function): Stream source

Set output stream transformation.

Params:

NameTypeAttributeDescription
arg_stream_transformation function

function (source stream)=>{ return transformed stream }.

Return:

Stream

this

public set_transformed_stream(arg_stream: Baconjs.Bus): Stream source

Set output stream.

Params:

NameTypeAttributeDescription
arg_stream Baconjs.Bus

transformed stream.

Return:

Stream

this

public subscribe(arg_handler: Function): Function source

Subscribe to stream values.

Params:

NameTypeAttributeDescription
arg_handler Function

value handler f(value) => nothing.

Return:

Function

unsubscribe function