本文整理汇总了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();
});
});