本文整理匯總了TypeScript中@angular/fire/database-deprecated.FirebaseListFactory函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript FirebaseListFactory函數的具體用法?TypeScript FirebaseListFactory怎麽用?TypeScript FirebaseListFactory使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了FirebaseListFactory函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: beforeEach
beforeEach((done: any) => {
toKey = (val: any) => val.key;
val1 = { key: 'key1' };
val2 = { key: 'key2' };
val3 = { key: 'key3' };
app.database().ref().remove(done);
questions = FirebaseListFactory(app.database().ref(`questions`));
questionsSnapshotted = FirebaseListFactory(app.database().ref(`questionssnapshot`), { preserveSnapshot: true });
ref = questions.$ref;
refSnapshotted = questionsSnapshotted.$ref;
});
示例2: it
it('should call off on all events when disposed', (done: any) => {
const questionRef = app.database().ref().child('questions');
subscription = FirebaseListFactory(questionRef).subscribe(_ => {
let firebaseSpy = spyOn(questionRef, 'off').and.callThrough();
expect(firebaseSpy).not.toHaveBeenCalled();
subscription.unsubscribe();
expect(firebaseSpy).toHaveBeenCalled();
done();
});
});
示例3: FirebaseListFactory
.run(() => {
// Creating a new observable so that the current zone is captured.
subscription = FirebaseListFactory(app.database().ref(`questions`))
.filter(d => d
.map((v: any) => v.$value)
.indexOf('in-the-zone') > -1)
.subscribe(data => {
expect(Zone.current.name).toBe('newZone');
done();
});
});