本文整理汇总了TypeScript中rxjs/ReplaySubject.ReplaySubject.asObservable方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ReplaySubject.asObservable方法的具体用法?TypeScript ReplaySubject.asObservable怎么用?TypeScript ReplaySubject.asObservable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rxjs/ReplaySubject.ReplaySubject
的用法示例。
在下文中一共展示了ReplaySubject.asObservable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
/**
* Creates an instance of Camera.
*
* @param {HTMLCanvasElement} mCanvas
*/
constructor(private mCanvas: HTMLCanvasElement) {
super();
this.mSizeChanged$ = new ReplaySubject<IBounds>(1);
this.mOnSizeChanged = this.mSizeChanged$.asObservable().debounceTime(200);
this.refreshProjection();
}
示例2: MemorySource
export function MemorySource(map: MemoryMap) {
const subject = new ReplaySubject();
try {
_recursiveMemorySource(subject, map, '');
subject.complete();
} catch (err) {
subject.error(err);
}
return subject.asObservable();
}
示例3: _updateUserProgramInCache
private async _updateUserProgramInCache(program: UserFacingProgram, resp: any): Promise<boolean> {
if (resp.result === 'updated' || resp.result === 'created') {
const cache = await this._cache.asObservable().take(1).toPromise();
const val = cache.find(p => p.guid === program.guid);
if (val) {
val.user = program;
this._cache.next(cache);
} else {
this._cache.next([{guid: program.guid, application: [], user: program}, ...cache]);
}
return true;
}
return false;
}
示例4: _recursiveFileSource
function _recursiveFileSource(p: string, root: string): Observable<Entry> {
const subject = new ReplaySubject();
access(p, fs.R_OK)
.then(() => stat(p))
.catch(err => { throw new FileSystemException(err); })
.then((stats) => {
if (stats.isFile()) {
if (p == root) {
// Root is a file. Error.
throw new SourceRootMustBeDirectoryException();
}
return readFile(p, 'utf-8')
.then((data) => {
const subpath = path.relative(root, p);
subject.next(new StaticEntry(path.dirname(subpath), path.basename(subpath), data));
});
} else {
return readdir(p)
.then((files) => {
return Promise.all(files.map((file) => {
return _recursiveFileSource(path.join(p, file), root)
.forEach((value) => {
if (value) {
subject.next(value);
}
});
}));
});
}
})
.then(() => subject.complete())
.catch((err) => subject.error(err));
return subject.asObservable();
}
示例5:
return input$.flatMap(data => Observable.zip(Observable.of(data), this._cache.asObservable()))
示例6: getPrograms
getPrograms(): Observable<ApplicationFacingProgram[]> {
return this._cache.asObservable();
}
示例7: findProgram
findProgram(guid: string): Observable<Program> {
return this._cache.asObservable()
.map(programs => programs.find(this._findProgram(guid)))
.map(p => p !== undefined ? new Program(p, this.fb) : null)
.map(p => p === null ? new Program(undefined, this.fb) : p)
}