本文整理匯總了TypeScript中rxjs/BehaviorSubject.BehaviorSubject.getValue方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript BehaviorSubject.getValue方法的具體用法?TypeScript BehaviorSubject.getValue怎麽用?TypeScript BehaviorSubject.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rxjs/BehaviorSubject.BehaviorSubject
的用法示例。
在下文中一共展示了BehaviorSubject.getValue方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: Promise
return new Promise((resolve) => {
this.af.database.list('/match/' + uid).subscribe((snapshots) =>{
this.subject.next(snapshots);
})
if(!this.subject.getValue()) {
this.af.database.list('/match/' + uid).subscribe((snapshots) =>{
resolve(snapshots);
});
return;
}
resolve(this.subject.getValue());
});
示例2:
return Observable.create((observer) => {
// setTimeout(function() {
this._todos.getValue().push(todo);
observer.next(true);
observer.complete();
// }, timeout);
});
示例3: buildPath
buildPath(): void {
let strategy = new TerrainPathFindingStrategy(this.grid);
let astar = new AStar(strategy);
let startCell = this.grid.getCell(this.startIndex);
let finishCell = this.grid.getCell(this.finishIndex);
let path = astar.GetPath(startCell, finishCell);
if (path.length > 0) {
path = [
startCell,
...
path
];
}
let pathChange: PathChangeEvent = {
currentPathIndexes: path.map(c => c.cellIndex),
oldPathIndexes: this.pathIndexesSubject.getValue().currentPathIndexes
};
this.pathIndexesSubject.next(pathChange);
}
示例4: updateState
private updateState(f: (x: CarState) => void) {
let newState: CarState = Object.assign({}, this.state$.getValue());
f(newState);
this.calculateValidity(newState);
this.state$.next(newState);
}
示例5: getSquare
/*
* Gets a square at a certain position
*/
getSquare(x: number, y: number): Square {
if(this.field.getValue()[y])
return this.field.getValue()[y][x];
}
示例6: getState
getState() {
return this.subject.getValue();
}
示例7: first
/**
* @return first
*/
get first() {
return this._first.getValue();
}
示例8: finishIndex
public get finishIndex() {
return this.finishIndexSubject.getValue().currentIndex;
}
示例9: from
get from() {
return this._first.getValue() + 1;
}
示例10: totalPages
get totalPages() {
return Math.ceil(this._totalResults.getValue() / this.pageSize);
}