我有一个幻灯片放映组件,它有一个幻灯片对象的输入数组,只要它slide.time本身被定义,就会显示每个对象.还有两个点击它们的按钮必须滑动到下一个项目并重置计时器.为了使这项工作,我正在使用这样的Observable:
/**
* a "SUBJECT" for pausing(restarting) the slider's auto-slide on user's click on left and right arrows
* @type {Subject}
*/
private pauser = new Subject();
/**
* the main observable for timer (before adding the pause/reset option)
* @type {Observable<T>}
*/
private source = Observable
.interval(1000)
.timeInterval()
.map(function (x) { /*return x.value + ':' + x.interval;*/ return x })
.share();
/**
* the final timer, which can be paused
* @type {Observable<R>}
*/
private pausableSource = …Run Code Online (Sandbox Code Playgroud)