• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript app.database函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: removeDayPlan

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


示例17: getDayPlanOrder

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


示例18: getDayPlanRef

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


示例19: getDayPlanListRef

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


示例20: removeUnreadMessage

 removeUnreadMessage(workerId: any) {
   return firebase.database().ref(`/workerList/${workerId}`).child('unreadMessages').set(0);
 }
开发者ID:getlabs,项目名称:bretapp,代码行数:3,代码来源:workers.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript app.firestore函数代码示例发布时间:2022-05-25
下一篇:
TypeScript app.auth函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap