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

TypeScript app.firestore函数代码示例

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

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



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

示例1: atomic

 atomic() {
   const batch = firebase.firestore().batch();
   /// add your operations here
   const itemDoc = firebase.firestore().doc('items/myCoolItem');
   const userDoc = firebase.firestore().doc('users/userId');
   const currentTime = this.timestamp;
   batch.update(itemDoc, { timestamp: currentTime });
   batch.update(userDoc, { timestamp: currentTime });
   /// commit operations
   return batch.commit();
 }
开发者ID:macliems,项目名称:JixyFront,代码行数:11,代码来源:firestore.service.ts


示例2: beforeEachHelper

export function beforeEachHelper(done): void {
  // Create a new Firebase database ref at a random node
  firestore = firebase.firestore();
  collection = firestore.collection(testCollectionName);
  geofirestore = new GeoFirestore(firestore);
  geocollection = new GeoCollectionReference(collection);
  done();
}
开发者ID:geofirestore,项目名称:geofirestore-js,代码行数:8,代码来源:common.ts


示例3: constructor

 constructor() {
     const firebaseConfig = {
         apiKey: "AIzaSyBw73BRk-qWeZm-fp3-Ijf7s0EemdaWuCQ",
         authDomain: "selecquest.firebaseapp.com",
         databaseURL: "https://selecquest.firebaseio.com",
         projectId: "selecquest",
         storageBucket: "selecquest.appspot.com",
         messagingSenderId: "434339253679"
     };
     firebase.initializeApp(firebaseConfig);
     this.db = firebase.firestore()
     this.db.enablePersistence({experimentalTabSynchronization: true});
 }
开发者ID:scunningham777,项目名称:SelecQuest,代码行数:13,代码来源:game-settings-manager.ts


示例4: setPageView

 public setPageView(key): void {
   const documentReference = this.afs.collection<ContentDetail>('postDetail').doc(key);
   firebase.firestore().runTransaction(page => {
       return page.get(documentReference.ref)
           .then(doc => {
               const newValue = doc.data().view + 1;
               page.update(documentReference.ref, {
                   view: newValue
               });
           });
   }).catch(() => {
     console.log('error');
   });
 }
开发者ID:niawjunior,项目名称:blog,代码行数:14,代码来源:page-view.service.ts


示例5: salvaLog

//****************************Datas */
 salvaLog(type,message,reload=false){
    let user = firebase.auth().currentUser;
    let d = new Date();
    firebase.firestore().collection('logs').add({
      type: type,
      message : JSON.stringify(message),
      date: this.getDate(),
      hour: this.getDate('h'),
    }).then(ref => {
      console.log('Adicionado')
      if(reload){
        window.location.reload();
      }
    })
}
开发者ID:aynoei,项目名称:promon,代码行数:16,代码来源:auth.service.ts


示例6: enableProdMode

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

if (environment.production) {
  enableProdMode();
}

import * as firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/firestore';

firebase.initializeApp(environment.firebase);
firebase.firestore().settings({ timestampsInSnapshots: true });

platformBrowserDynamic().bootstrapModule(AppModule, { ngZone: 'noop'})
  .catch(err => console.error(err));
开发者ID:janjachacz,项目名称:fireship.io,代码行数:19,代码来源:main.ts


示例7:

import "firebase/firestore";
import { Project } from "../store/projects/reducer";

const config = {
  apiKey: process.env.REACT_APP_API_KEY,
  authDomain: process.env.REACT_APP_AUTH_DOMAIN,
  databaseURL: process.env.REACT_APP_DATABASE_URL,
  projectId: process.env.REACT_APP_PROJECT_ID,
  storageBucket: process.env.REACT_APP_STORAGE_BUCKET,
  messagingSenderId: process.env.REACT_APP_MESSAGING_SENDER_ID
};

app.initializeApp(config);

export const auth: app.auth.Auth = app.auth();
export const firestore: app.firestore.Firestore = app.firestore();

// Required because @firebase/firestore will change
// the behavior for Date objects stored in Firestore.
// Code expecting dates must be updated
// to expect timestamps instead:
// const timestamp = snapshot.get('created_at');
// const date = timestamp.toDate();
const settings = { timestampsInSnapshots: true };
firestore.settings(settings);

// this.auth.onAuthStateChanged(this.onAuthStateChanged);

// onAuthStateChanged = (user: app.User | null) => {
//   this.user = user;
// };
开发者ID:esseb,项目名称:scheduler,代码行数:31,代码来源:firebase.ts


示例8:

import firebase from "firebase/app";
import "firebase/auth";
import "firebase/firestore";

firebase.initializeApp({
  apiKey: "AIzaSyCjBDyhwbXcp9kEIA2pMHLDGxmCM4Sn6Eg",
  authDomain: "canigraduate-43286.firebaseapp.com",
  projectId: "canigraduate-43286"
});

export const firestore = firebase.firestore();
firestore.settings({ timestampsInSnapshots: true });

export const auth = firebase.auth();
开发者ID:kevmo314,项目名称:canigraduate.uchicago.edu,代码行数:14,代码来源:firebase.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript app.initializeApp函数代码示例发布时间:2022-05-25
下一篇:
TypeScript app.database函数代码示例发布时间: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