当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript app.database函数代码示例

本文整理汇总了TypeScript中firebase/app.database函数的典型用法代码示例。如果您正苦于以下问题:TypeScript database函数的具体用法?TypeScript database怎么用?TypeScript database使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了database函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: Promise

		return new Promise((resolve) => {
			firebase.database()
				.ref(`/${query.db}`)
				.orderByChild("inhdd")
				.equalTo(1)
				.on("value", (data) => resolve(this.objectToArray(data.val())));
		});
开发者ID:RinMinase,项目名称:anidb,代码行数:7,代码来源:firebase.service.ts

示例2: constructor

    constructor(model: BagitModelService)
    {
        this._curFirebaseUser = undefined;
        this._currentUser$    = new BehaviorSubject<User | null>(null);
        this._model = model;

        //
        // Setup to handle authentication state changes.
        //
        this._authInitializedPromise = new Promise((resolve) => {
            // Hang on to the resolve function so that we can call it once the
            // initial auth state change happens.
            this._resolveAuthInitializedPromise = resolve;

        });
        this._firebaseAuth = auth();
        this._firebaseAuth.onAuthStateChanged(this.onAuthStateChanged.bind(this));

        this._isConnected$ = new BehaviorSubject<boolean>(false);
        const connectedRef = database().ref(".info/connected");
        connectedRef.on("value", (snap: database.DataSnapshot | null) => {
            if (snap) {
                this._isConnected$.next(snap.val());
            }
        });
    }
开发者ID:kwpeters,项目名称:bagit,代码行数:26,代码来源:model-user.service.ts

示例3: inject

 inject([FirebaseApp, AngularFireDatabase], (_app: firebase.app.App, _db: AngularFireDatabase) => {
   app = _app;
   db = _db;
   ref = firebase.database().ref();
   O = new FirebaseObjectObservable((observer: Observer<any>) => {
   }, ref);
 })();
开发者ID:mhartington,项目名称:angularfire2,代码行数:7,代码来源:firebase_object_observable.spec.ts

示例4: update

	update(params: FirebaseQuery) {
		const { db, id, data } = params;
		if (db && id && data) {
			return Promise.resolve(firebase.database()
				.ref(`/${db}/${id}`)
				.update(data));
		}

		return Promise.reject();
	}
开发者ID:RinMinase,项目名称:anidb,代码行数:10,代码来源:firebase.service.ts

示例5: hardDelete

	hardDelete(params: FirebaseQuery) {
		const { db, id } = params;
		if (db && id) {
			return Promise.resolve(firebase.database()
				.ref(`/${db}/${id}`)
				.remove());
		}

		return Promise.reject();
	}
开发者ID:RinMinase,项目名称:anidb,代码行数:10,代码来源:firebase.service.ts

示例6: it

 it('should call off on all events when disposed', (done: any) => {
   const questionRef = firebase.database().ref().child('questions');
   var firebaseSpy = spyOn(questionRef, 'off').and.callThrough();
   subscription = FirebaseListFactory(questionRef).subscribe(_ => {
     expect(firebaseSpy).not.toHaveBeenCalled();
     subscription.unsubscribe();
     expect(firebaseSpy).toHaveBeenCalled();
     done();
   });
 });
开发者ID:julienevano,项目名称:angularfire2,代码行数:10,代码来源:firebase_list_factory.spec.ts

示例7: addUnreadMessage

  addUnreadMessage(workerId: any) {
    let databaseRef = firebase.database().ref(`/workerList/${workerId}`).child('unreadMessages');

    databaseRef.transaction(function (searches) {
      if (searches || searches == 0) {
        searches = searches + 1;
      }
      return searches;
    });
  }
开发者ID:getlabs,项目名称:bretapp,代码行数:10,代码来源:workers.ts

示例8: beforeEach

 beforeEach((done: any) => {
   toKey = (val) => val.key;
   val1 = { key: 'key1' };
   val2 = { key: 'key2' };
   val3 = { key: 'key3' };
   firebase.database().ref().remove(done);
   questions = FirebaseListFactory(`questions`);
   questionsSnapshotted = FirebaseListFactory(`questionssnapshot`, { preserveSnapshot: true });
   ref = questions.$ref;
   refSnapshotted = questionsSnapshotted.$ref;
 });
开发者ID:julienevano,项目名称:angularfire2,代码行数:11,代码来源:firebase_list_factory.spec.ts

示例9: LoginDialog

        $(async () => {
            if (user === null) {
                this.budget = null
                Spinner.hide();
                if (this.transactionList) { this.transactionList.clear(); }
                
                // show the login dialog
                this.pnlMenu.close();
                let loginDialog = new LoginDialog(this.login.bind(this), this.resetPassword.bind(this), this.signup.bind(this));
                loginDialog.open();
            } else {
                ModalSpinner.show();

                let config = (await firebase.database().ref(user.uid).child('config').once('value')).val() as ConfigurationData;

                if (config === null || config.showWizard == true) {
                    // not yet initilized or need to see the wizard
                    ModalSpinner.hide();
                    await ShowIntroWizard(firebase.database().ref(user.uid).child('config'));
                    ModalSpinner.show();
                }

                this.budget = new Budget(firebase.database().ref(user.uid));

                this.budget.on('config_read', this.config_onRead.bind(this));
                this.budget.on('history_change', () => {
                    this.btnUndo.disabled = !this.budget.CanUndo;
                    this.btnRedo.disabled = !this.budget.CanRedo;
                });

                this.budget.ready().then(() => {
                    this.previewer.listenToTransactions(this.budget.Transactions);
                    this.transactionList.listenToTransactions(this.budget.Transactions);
                    this.chart.listenToTransactions(this.budget.Transactions);
                    this.budget.on('loadperiod', this.periodLoaded.bind(this));
                    // this.gotoDate(Date.today());
                    this.budget.gotoDate(Date.today());

                });
            }
        });
开发者ID:mlaanderson,项目名称:firebase-budget,代码行数:41,代码来源:viewer.ts

示例10: supplyRequested

export const requestSupply = (room: Room, supply: Supply) => {
  firebase
    .database()
    .ref(`roomSupplies/${room.id}_${supply.id}`)
    .update({
      room: room.id,
      supply: supply.id,
      requested: firebase.database.ServerValue.TIMESTAMP,
    });

  supplyRequested(supply, Date.now());
  setRequestedSupply(supply);
};
开发者ID:vdsabev,项目名称:betahaus-sofia-office-manager,代码行数:13,代码来源:index.ts

示例11:

export const unsubscribeFromSupplies = (room: Room, supplies: Supply[]) => {
  if (room) {
    firebase
      .database()
      .ref(`rooms/${room.id}/supplies`)
      .off('child_added');
    supplies.forEach((supply) => {
      firebase
        .database()
        .ref(`roomSupplies/${room.id}_${supply.id}/requested`)
        .off('value');
    });
  }
};
开发者ID:vdsabev,项目名称:betahaus-sofia-office-manager,代码行数:14,代码来源:index.ts

示例12: Supply

        .once('value', (supplySnapshot: DataSnapshot<Supply>) => {
          const supply = new Supply({ id: supplySnapshot.key }, supplySnapshot.val());
          addSupply(supply);

          firebase
            .database()
            .ref(`roomSupplies/${room.id}_${supply.id}/requested`)
            .on('value', (requestedSnapshot: DataSnapshot<number>) => {
              const requested = requestedSnapshot.val();
              if (requested) {
                supplyRequested(supply, Math.min(requested, Date.now()));
              }
            });
        });
开发者ID:vdsabev,项目名称:betahaus-sofia-office-manager,代码行数:14,代码来源:index.ts

示例13: removeOrderFromDayPlan

 removeOrderFromDayPlan(dayPlanId: any, orderId: any) {
   return firebase.database().ref(`/dayPlanList/${dayPlanId}/ordersObj/`).child(orderId).remove();
 }
开发者ID:getlabs,项目名称:bretapp,代码行数:3,代码来源:day-plan.ts

示例14: updateOrder

 updateOrder(dayPlanId: any, orderId: any, order: any) {
   return firebase.database().ref(`/dayPlanList/${dayPlanId}/ordersObj`).child(orderId).set(order);
 }
开发者ID:getlabs,项目名称:bretapp,代码行数:3,代码来源:day-plan.ts

示例15: updateDayPlan

 updateDayPlan(dayPlanId: any, dayPlan: any) {
   return firebase.database().ref(`/dayPlanList/`).child(dayPlanId).set(dayPlan);
 }
开发者ID:getlabs,项目名称:bretapp,代码行数:3,代码来源:day-plan.ts


注:本文中的firebase/app.database函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。