This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
nativescript-firebase with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
This is a Nativescript-compatible wrapper for the Firebase node.js SDK.
This module is licensed under the MIT license. Firebase and other modules have different licenses.
tns plugin add nativescript-firebase
Exactly the same as Firebase for node.js:
var Firebase = require("nativescript-firebase"); var fb = new Firebase("some-app.firebaseio.com");
This module uses the actual Firebase node.js SDK (see package.json dependencies).
This module provides some dependencies required by the Firebase node.js SDK in the form of bundled modules. Versions 0.0.1 and 0.0.2 used a modified
require function but I changed this because around version 1.5.0 of Nativescript it seems they replaced the global
require with a parameter supplied to each module, meaning it couldn't be overwritten.
The bundled modules are mostly just wrappers around other modules, or internal Nativescript functionality. They are:
tiny-emitterwhich is Nativescript compatible)
nativescript-websockets- see below)
https-browserifywhich in turn uses Nativescript's
I've set the version number of the
inherits wrappers to 999.9.9 to override the modules in deeper dependencies.
The following modules are also used, and are Nativescript-compatible out of the box:
The following global variables are also created to make the modified modules and Firebase work:
This is made possible by a modified version of NathanaelA's nativescript-websockets module, with a workaround for an SSL issue. This module is the substitute for the
faye-websocket module required by Firebase.
This module hasn't been rigorously tested. Here's what's working for me:
Most features should be working, but there might be more bugfixes to come. I'm using this in a project of mine so it'll get further tested as I use it more.
Note that this might have problems with Nativescript 1.5.1 due to this issue.