Class: ddpReducer

ddpReducer

A reducer class for a reactive document.

new ddpReducer (ddpReactiveCollectionInstance, reducer, initialValue)

Name Type Description
ddpReactiveCollectionInstance ddpReactiveCollection

Instance of @see ddpReactiveCollection class.

reducer function

Function for a reduction.

initialValue *

Initial value for a reduction function.

Classes

ddpReducer

Methods

data ()Object

Returns reactive reduce.

Returns:
Type Description
Object
  • {result:reducedValue}

doReduce ()

Forcibly reduces reactive data.

onChange (f)

Runs a function every time a change occurs.

Name Type Description
f function

Function which recieves a reduced value at each change.

start ()

Starts reactiveness for the reduced value of the collection. This method is being called on instance creation.

stop ()

Stops reactiveness.