Firebase Connector
Firebase Connector - simple javascript (ES6) library to create connection with Firebase.
Install
Just copy & paste to your command line
npm i firebase-connector --save
Repo
https://github.com/michalstol/firebase-connector/
Start
Firebase Connector is simple to use.
-
extend your class like this:
-
pass the firebase config like this:
{superapiKey: "your-api-key"authDomain: "your-app.firebaseapp.com"databaseURL: "https://your-app.firebaseio.com"projectId: "your-app"storageBucket: "your-app.appspot.com"messagingSenderId: "your-app-sender";}How generate this config you can found on this site -> Firebase Console Page
-
use specific method & fun! :)
Variables
This library give you only few method but you can use all Firebase method. How? Just using this useful variables:
// Firebase initializethisapp // Firebase auththisauth // Firebase databasethisdb // Firebase storagethisstorage
Method
Just few method to use Firebase
SignIn
In your extended class just call and past 2 variables:
this
You can catch callback using this method:
this // your code this // your code this // your code
GetDB
In your extended class just call and past 1 variable:
this;
This method return object from your ref.
GetStorage
In your extended class just call and past 1 variable:
this;
This method return object from your ref.
SaveDB
In your extended class just call and past 2 variables:
this;
UploadFiles
In your extended class just call and past object with 3 variables.
Warning - for now you can only upload file using data_url - eg. image base64.
const newFile = path: 'pathOfStorage' file: 'userFile' name: 'fileName'; this;
This method have 2 callbacks:
During transfer
this // your code
During transfer
this // your code
Test
You can also make a test. Upload repo from this place. Next install all package:
npm install
Change config in test.js and build app using this commend:
npm run test
Last step is run from /test folder test.html. Now you can signUp and build test app.