This repository was archived by the owner on Oct 1, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
docs(operators): add documentation for sample & sampleTime #207
Open
hardikpthv
wants to merge
22
commits into
ReactiveX:master
Choose a base branch
from
hardikpthv:iss-192
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
cfbe5be
docs(operators): add documentation for sample
hardikpthv cc7666c
fix(operators): add markdown code to highlight keyword and replace va…
hardikpthv cdee0d0
docs(operators): add documentation for sampleTime
hardikpthv 5072a36
Merge branch 'master' into iss-192
sumitarora 17e6cb8
fix(operators): update code snippets
hardikpthv 2865cb3
fix(operators): add link to existing operator
hardikpthv 4c80ee7
Merge branch 'master' into iss-192
hardikpthv ad3cce0
Merge branch 'master' into iss-192
hardikpthv c442d6f
fix(operators): add link to existing operator and markdown to keywords
hardikpthv 829ac13
Merge branch 'master' into iss-192
hardikpthv 5dfd268
Merge branch 'master' into iss-192
hardikpthv 2b814f3
Merge branch 'master' into iss-192
hardikpthv e81780c
Merge branch 'master' into iss-192
hardikpthv 0548cc6
Merge branch 'master' into iss-192
hardikpthv 7c09379
Merge branch 'master' into iss-192
hardikpthv abcfc64
Merge branch 'master' into iss-192
hardikpthv 1a7cd49
Merge branch 'master' into iss-192
hardikpthv 7c69716
Merge branch 'master' into iss-192
sumitarora 91f9546
Merge branch 'master' into iss-192
hardikpthv c43c502
fix(operators): update code snippet
hardikpthv 4160552
fix(operators): remove generic
hardikpthv 82e67e4
Merge branch 'master' into iss-192
hardikpthv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| import { OperatorDoc } from '../operator.model'; | ||
|
|
||
| export const sampleTime: OperatorDoc = { | ||
| name: 'sampleTime', | ||
| operatorType: 'filtering', | ||
| signature: | ||
| 'public sampleTime(period: number, scheduler: Scheduler): Observable<T>', | ||
| marbleUrl: 'http://reactivex.io/rxjs/img/sampleTime.png', | ||
| parameters: [ | ||
| { | ||
| name: 'period', | ||
| type: 'number', | ||
| attribute: '', | ||
| description: `The sampling period expressed in milliseconds or the time unit determined internally by the optional scheduler.` | ||
| }, | ||
| { | ||
| name: 'scheduler', | ||
| type: 'Scheduler', | ||
| attribute: 'optional default: async', | ||
| description: `The IScheduler to use for managing the timers that handle the sampling.` | ||
| } | ||
| ], | ||
| shortDescription: { | ||
| description: `Emits the most recently emitted value from the source Observable within periodic time intervals.`, | ||
| extras: [ | ||
| { | ||
| type: 'Tip', | ||
| text: `Samples the source Observable at periodic time intervals, emitting what it samples.` | ||
| } | ||
| ] | ||
| }, | ||
| walkthrough: { | ||
| description: ` | ||
| <p> | ||
| <span class="markdown-code">sampleTime</span> periodically looks at the source | ||
| Observable and emits whichever value it has most recently emitted since the previous | ||
| sampling, unless the source has not emitted anything since the previous sampling. | ||
| The sampling happens periodically in time every <span class="markdown-code">period</span> | ||
| milliseconds (or the time unit defined by the optional <span class="markdown-code">scheduler</span> argument). | ||
| The sampling starts as soon as the output Observable is subscribed. | ||
| </p> | ||
| ` | ||
| }, | ||
| examples: [ | ||
| { | ||
| name: 'Every second, emit the most recent click at most once', | ||
| code: ` | ||
| const clicks = Rx.Observable.fromEvent(document, 'click'); | ||
|
||
| const result = clicks.sampleTime(1000); | ||
| result.subscribe(x => console.log(x)); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add expected output
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hardikpthv I'm a bit confused :D will you take care of your comments in this pr :D
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure @jwo719 It is for my reference :D |
||
| `, | ||
| externalLink: { | ||
| platform: 'JSBin', | ||
| url: 'http://jsbin.com/hohulon/embed?js,console,output' | ||
| } | ||
| } | ||
| ], | ||
| relatedOperators: [ | ||
| 'auditTime', | ||
| 'debounceTime', | ||
| 'delay', | ||
| 'sample', | ||
| 'throttleTime' | ||
| ], | ||
| additionalResources: [] | ||
| }; | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove generic