How to use the firebase function in firebase

To help you get started, we’ve selected a few firebase examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Swimburger / gkeep-vueifire / src / data / NoteRepository.js View on Github external
constructor () {
    super()
    // firebase reference to the notes
    this.ref = new Firebase('https://gkeep-vueifire3.firebaseio.com') // will have same result as new Firebase('https://resplendent-heat-896.firebaseio.com/').child('notes')
  }
  // creates a note
github tngan / redux-hacker-news / services / api.firebase.js View on Github external
// Rewritten and forked from insin/react-hn

import Firebase from 'firebase';
import { MAX_THREAD_NUMBER, BASE_API_URL } from '../constants';

let api = new Firebase(BASE_API_URL);

export function getItem (itemId, callback) {
	itemRef(itemId).once('value', snapshot => callback(snapshot.val()));
}

export function getCommentItems (itemIds, callback) {
	let items = new Map();
	itemIds.forEach(itemId => getItem(itemId, item => {
		if(item.type === 'comment') items.set(itemId, item);
		if (items.size >= MAX_THREAD_NUMBER) callback(items, false);
		if (itemIds[itemIds.length-1] === itemId) callback(items, true); // current last item
	}));
}

export function getItems (itemIds, callback) {
  	let items = new Map();
github christinecha / clickbaiter / public / app.js View on Github external
"use strict"

import React from 'react'
import ReactDOM from 'react-dom'
import Firebase from 'firebase'
import * as helper from './helpers'
import * as dictionary from './dictionary'

let ref = new Firebase("https://clickbaiter.firebaseio.com/")

class App extends React.Component {

  // Set up the state template. Not using null values so in the worst case scenario, it
  // would just print wrong information rather than breaking completely.
  constructor() {
    super()
    this.state = {
      gotcha: false,
      title: "",
      description: "",
      imageLink: "",
      siteName: "",
      shareLink: "",
      clickCount: 0,
    }
github jxe / hindsight / background.jsx View on Github external
import React from 'react'
import ReactDOM from 'react-dom'
import { Button } from 'react-ratchet'

import Firebase from 'firebase'
let FIREBASE = new Firebase('https://lifestyles.firebaseio.com/')

import Activities from 'chrome-activities'
Activities.trackActivities()

import Reasons from 'reasons'
import ReviewPanel from 'reasons/activities/reviewPage.jsx'
import LocalReviews from 'reasons/activities/localReviews'


Activities.onActivityChanged(a => {
  console.log("onActivityChanged", a)
  let d = LocalReviews.forActivity(a)

  var eyeImage
  if (d){
    if (d == 'skip') eyeImage = 'clear'
github luhtonen / learn-reactjs-and-flux / contactlist / app / utils / appAPI.js View on Github external
export function updateContact(contact) {
  const updatedContact = {
    name: contact.name,
    phone: contact.phone,
    email: contact.email
  };
  let firebaseRef = new Firebase('https://educontactlist.firebaseio.com/contacts/' + contact.id + '/contact');
  firebaseRef.update(updatedContact);
}
export function getContacts() {
github jingweno / hacker-menu / src / server / story_manager.js View on Github external
constructor (maxNumOfStories, cache) {
    super()
    this.maxNumOfStories = maxNumOfStories
    this.fb = new Firebase('https://hacker-news.firebaseio.com/v0')
    this.cache = cache
    this.stories = {}
  }
github mtmckenna / croissant-runner-ember / app / hi-score / adapter.js View on Github external
import config from '../config/environment';
import Firebase from 'firebase';
import FirebaseAdapter from 'emberfire/adapters/firebase';

export default FirebaseAdapter.extend({
  firebase: new Firebase(config.firebase)
});
github jamesdixon / ember-cli-simple-auth-firebase / app / authenticators / firebase.js View on Github external
init: function() {
        if (config.firebase) {
            this.set('firebase', new Firebase(config.firebase));
        } else {
            throw new Error("'firebase' not defined in environment");
        }

        this._super();
    },
    firebase: null,
github prescottprue / fireadmin / src / index.js View on Github external
constructor (url, opts) {
    if (!url) throw new Error('Firebase url is required to use Fireadmin')
    this.url = url
    this.rootRef = new Firebase(url)
    this.name = nameFromUrl(url)
    if (opts) this.options = opts
    Object.assign(this, auth(this.rootRef))
  }