Skip to content

Commit

Permalink
[added] log operator
Browse files Browse the repository at this point in the history
Reviewers: O3 Material JavaScript platform reviewers, #material_motion, O2 Material Motion, featherless

Reviewed By: #material_motion, O2 Material Motion, featherless

Tags: #material_motion

Differential Revision: http://codereview.cc/D2520
  • Loading branch information
appsforartists committed Jan 23, 2017
1 parent 886790e commit 8da6905
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/streams/src/observables/MotionObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,22 @@ export class MotionObservable<T> extends IndefiniteObservable<T> {
);
}

/**
* Logs every value that passes through this section of the stream, and passes
* them downstream.
*
* Adding `log` to stream chain should have no effect on the rest of the
* chain.
*/
log(): MotionObservable<T> {
return this._nextOperator(
(value: T, nextChannel: NextChannel<T>) => {
console.log(value);
nextChannel(value);
}
);
}

/**
* Limits the number of dispatches to one per frame.
*
Expand Down

0 comments on commit 8da6905

Please sign in to comment.