本文整理匯總了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)
}