當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript FirebaseApp.database方法代碼示例

本文整理匯總了TypeScript中angularfire2.FirebaseApp.database方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript FirebaseApp.database方法的具體用法?TypeScript FirebaseApp.database怎麽用?TypeScript FirebaseApp.database使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在angularfire2.FirebaseApp的用法示例。


在下文中一共展示了FirebaseApp.database方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
 });
開發者ID:Tetsumote,項目名稱:angularfire2,代碼行數:11,代碼來源:firebase_list_factory.spec.ts

示例2: inject

 inject([FirebaseApp, PlatformRef], (_app: FirebaseApp, _platform: PlatformRef) => {
   app = _app;
   rootRef = app.database().ref();
   questionsRef = rootRef.child('questions');
   listOfQuestionsRef = rootRef.child('list-of-questions');
   defaultPlatform = _platform;
 })();
開發者ID:cartant,項目名稱:angularfire2,代碼行數:7,代碼來源:angularfire2.spec.ts

示例3: inject

 inject([FirebaseApp, AngularFireDatabase], (_app: FirebaseApp, _db: AngularFireDatabase) => {
   app = _app;
   db = _db;
   ref = app.database().ref();
   O = new FirebaseObjectObservable((observer: Observer<any>) => {
   }, ref);
 })();
開發者ID:Tetsumote,項目名稱:angularfire2,代碼行數:7,代碼來源:firebase_object_observable.spec.ts

示例4: 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();
   });
 });
開發者ID:Tetsumote,項目名稱:angularfire2,代碼行數:10,代碼來源:firebase_list_factory.spec.ts

示例5: 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();
     });
 });
開發者ID:Tetsumote,項目名稱:angularfire2,代碼行數:11,代碼來源:firebase_list_factory.spec.ts

示例6: it

 it('should process a new child_changed event', (done) => {
   const aref = ref(rando());
   const obs = listChanges(aref, ['child_added','child_changed'])
   const sub = obs.skip(1).take(1).subscribe(changes => {
     const data = changes.map(change => change.payload.val());
     expect(data[1].name).toEqual('lol');
   }).add(done);
   app.database().goOnline();
   aref.set(batch).then(() => {
     aref.child(items[1].key).update({ name: 'lol'});
   });
 });
開發者ID:acipher,項目名稱:angularfire2,代碼行數:12,代碼來源:changes.spec.ts


注:本文中的angularfire2.FirebaseApp.database方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。