本文整理汇总了TypeScript中firebase.database函数的典型用法代码示例。如果您正苦于以下问题:TypeScript database函数的具体用法?TypeScript database怎么用?TypeScript database使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了database函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(public nav: NavController) {
this.fireAuth = firebase.auth();
this.userProfile = firebase.database().ref('/userProfile');
this.userData = firebase.database().ref('/userData');
this.facebookAuth = new firebase.auth.FacebookAuthProvider();
this.googleAuth = new firebase.auth.GoogleAuthProvider();
}
示例2: constructor
constructor() {
this.uId = firebase.auth().currentUser.uid;
this.tracktorsQuery = firebase.database().ref('tracktors/')
.limitToLast(100);
this.fieldsQuery = firebase.database().ref('fields/')
.limitToLast(100);
}
示例3: init
init() {
const fbConf = {
apiKey: "AIzaSyD44soNIK81xzRjQXZ2Lmlb03CBIx4zVY4",
authDomain: "fir-app-f088c.firebaseapp.com",
databaseURL: "https://fir-app-f088c.firebaseio.com",
storageBucket: "fir-app-f088c.appspot.com"
};
firebase.initializeApp(fbConf);
this.db = firebase.database().ref('/');
this.staticData = firebase.database().ref('/static');
this.privateData = firebase.database().ref('/private');
}
示例4: constructor
constructor(
private http: Http,
private user: User
) {
if ('Notification' in window) {
this.messaging = firebase.messaging();
this.db = firebase.database();
if (user.admin) {
this.requestPermission();
}
this.messaging.onMessage((payload) => {
if ( payload && payload['notification'] ) {
if ( payload['notification']['title'] == 'LiveChat') return;
alert(payload['notification']['title'] + "\n" + payload['notification']['body']);
location.href = payload['notification']['click_action'];
}
});
}
}
示例5: initRetro
initRetro(retroUid: string) {
this.retroUid = retroUid;
return firebase.database().ref(`retros/${this.retroUid}`).transaction((retro) => {
if (!retro) {
retro = {
buckets: {
'1': {
color: '#ffff8d',
icon: 'start',
name: 'Start doing'
},
'2': {
color: '#a7ffeb',
icon: 'continue',
name: 'Continue'
},
'3': {
color: '#ff8a80',
icon: 'stop',
name: 'Stop doing'
}
},
step: 'ADD_ITEMS'
};
}
return retro;
}).then(() => {
this.ref(`participants/${this.currentUser.uid}`).set({
name: this.currentUser.displayName,
email: this.currentUser.email,
photoURL: this.currentUser.photoURL || this.defaultPhothoURL
});
});
}
示例6: constructor
constructor(private nav: NavController, public af: AngularFire) {
this.map = null;
this.loadMap();
this.ref = firebase.database().ref();
this.ftLocation = new GeoFire(this.ref.child('_geofire'));
}
示例7: constructor
constructor(public af: AngularFire) {
this.ref = firebase.database().ref();
this.gfLocation = new GeoFire(this.ref.child('_geofire'));
this.initList();
this.items = [];
this.geoQuery = null;
}
示例8:
.then(newUser => {
firebase
.database()
.ref('/workerList')
.child(newUser.uid)
.set({ email: email, name: name, abteilung: abteilung });
});
示例9: function
firebase.auth().onAuthStateChanged((user) => {
if (user) {
// If there's a user take him to the home page.
//this.nav.setRoot(TabsPage);
this.currentUser = user;
this.userProfile = firebase.database().ref('/userProfile');
var that = this;
var ref = this.userProfile.child(firebase.auth().currentUser.uid);
ref.once("value", function(snapshot) {
if(!snapshot.exists() ||
!snapshot.child("birthDate").exists() ||
!snapshot.child("fitness").exists() ||
!snapshot.child("goal").exists() ||
!snapshot.child("height").exists() ||
!snapshot.child("mealType").exists() ||
!snapshot.child("sex").exists() ||
!snapshot.child("weight").exists()) {
//that.nav.setRoot(OnboardingPage);
}
else {
//that.nav.setRoot(TabsPage);
}
});
} else {
// If there's no user logged in send him to the LoginPage
//this.nav.setRoot(LoginPage);
}
});
示例10: constructor
constructor(public nav: NavController) {
//creates a firebase auth reference, now you can get access to all the auth methods with this.fireAuth
this.fireAuth = firebase.auth();
//creating a database reference to the userProfile node on my firebase database.
this.userProfile = firebase.database().ref('/userProfile');
}