Show:

Differential is a Stream that emits differentials of consecutive input values.

It emits start, update and end events.

Constructor

Streams.Differential

(
  • [options]
)

Parameters:

  • [options] Object optional

    Options

    • [scale] Number optional

      Scale to apply to differential

Example:

 var differential = new Differential();
         // this gives differentials of mouse input
         differential.subscribe(mouseInput.pluck('value'));

Methods

"on"

(
  • type
  • handler
)

Inherited from Core.OptionsManager:

Adds a handler to the type channel which will be executed on emit.

Parameters:

filter

(
  • filterFn
)

Inherited from Streams.SimpleStream:

Filter converts the current stream into a new stream that only emits if the filter condition is satisfied. The function should return a Boolean.

Parameters:

  • filterFn Function
    Function to filter event payload

get

(
  • key
)
Object

Inherited from Core.OptionsManager:

Look up options value by key or get the full options hash.

Parameters:

Returns:

Object:

Associated object or full options hash

getOptions

()

Inherited from Core.OptionsManager:

Alias for get

key

(
  • key
)
OptionsManager

Inherited from Core.OptionsManager:

Return OptionsManager based on sub-object retrieved by key.

Parameters:

Returns:

OptionsManager:

Value

map

(
  • mapperFn
)

Inherited from Streams.SimpleStream:

Map converts the current stream into a new stream with a modified (mapped) data payload.

Parameters:

  • mapperFn Function
    Function to map event payload

off

(
  • type
  • handler
)

Inherited from Core.OptionsManager:

Removes the handler from the type channel. This undoes the work of on.

Parameters:

OptionsManager.patch

(
  • options
  • patch
)
Object

Inherited from Core.OptionsManager but overwritten in

Constructor method. Create OptionsManager from source dictionary with arguments overriden by patch dictionary.

Parameters:

  • options Object

    Options to be patched

  • patch ...Object

    Options to overwrite

Returns:

Object:

source

patch

(
  • options
)
OptionsManager

Inherited from Core.OptionsManager:

Patch options with provided patches. Triggers change event on the object.

Parameters:

  • options Object

    Patch options

Returns:

OptionsManager:

this

pluck

(
  • key
)

Inherited from Streams.SimpleStream:

Pluck is an opinionated mapper. It projects a Stream onto one of its return values. Useful if a Stream returns an array or an object.

Parameters:

set

(
  • key
  • value
)
OptionsManager

Inherited from Core.OptionsManager:

Set key to value. Outputs change event if a value is overwritten.

Parameters:

Returns:

OptionsManager:

Updated OptionsManager

setOptions

()

Inherited from Core.OptionsManager:

Alias for patch

split

(
  • splitterFn
)

Inherited from Streams.SimpleStream:

Split maps one of several streams based on custom logic. The function should return an EventEmitter.

Parameters: