markdown [Firebase] #firebase

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown [Firebase] #firebase相关的知识,希望对你有一定的参考价值。

---
title: Firebase
prism_languages: [coffeescript]
tags: [WIP]
layout: 2017/sheet
---

### Authenticating

```js
FB = new Firebase('https://xxx.firebase.io')
FB.auth(TOKEN, (err, result) => { ···})
```

```js
FB.authAnonymously(···)
FB.authWithPassword(···)
FB.authWithOAuthPopup(···)
FB.authWithOAuthToken(···)
```

### Using

```js
Users = FB.child('users')
```

```js
// Create
user = Users.push(first: "Frank", last: "Sinatra")
```

```js
// Retrieve
user = Users.child('alan')  // gets `users/alan`
```

```js
// Update
user.set(first: "Miles", last: "Davis")
user.update(first: "Miles")
user.setWithPriority({ ··· }, priority)
```

```js
// Destroy
user.remove()
```

```js
// Getting
user.name()  // primary id

user.once('value', (snap) => {
  snap.name()  // primary id
  snap.val()   // value
}, (err) => {
  ···
})
```

```js
// traversal
user.parent()
```

### Querying

```coffeescript
Users = FB.child('users')
Users
  .startAt(1000)
  .limit(50)
  .equalTo(priority, [name])
  .on 'child_added', (snap) -> ···
```
### Lists

```coffeescript
Posts = FB.child('posts')
post = Posts.push({ title: "How to do things", author: "alan" })
```

## References
{: .-one-column}

* <https://www.firebase.com/docs/web/api/>
* <https://www.firebase.com/docs/web/recipes.html>

以上是关于markdown [Firebase] #firebase的主要内容,如果未能解决你的问题,请参考以下文章

node_modules/@angular/fire/firebase.app.module.d.ts 中的错误?

使用@angular/fire@6.0.3 无法访问firebase.firestore.FieldValue.serverTimestamp()

markdown 介绍Fire语言

Fire Storage Exception([firebase_storage/unauthorized] 用户无权执行所需的操作。)(我的规则是允许读/写)

如果超时或无法访问服务器,Fire base 不会调用 onCancelled

如何在 Fire Base 中使用完成处理程序