Packagecom.distriqt.extension.firebase.database
Classpublic final class FirebaseDatabase
InheritanceFirebaseDatabase Inheritance flash.events.EventDispatcher

This class represents the Firebase Realtime Database extension.



Public Properties
 PropertyDefined By
  implementation : String
[read-only] The implementation currently in use.
FirebaseDatabase
  instance : FirebaseDatabase
[static] [read-only] The singleton instance of the FirebaseDatabase class.
FirebaseDatabase
  isSupported : Boolean
[static] [read-only] Whether the current device supports the extensions functionality
FirebaseDatabase
  nativeVersion : String
[read-only] The native version string of the native extension.
FirebaseDatabase
  service : FirebaseDatabase
[static] [read-only] The singleton instance of the FirebaseDatabase class.
FirebaseDatabase
  version : String
[read-only] The version of this extension.
FirebaseDatabase
Public Methods
 MethodDefined By
  
Constructor You should not call this directly, but instead use the singleton access
FirebaseDatabase
  
dispose():void
Disposes the extension and releases any allocated resources.
FirebaseDatabase
  
During the course of using the Firebase Realtime Database extension you will be creating and destroying references and queries that may not get immediately disposed.
FirebaseDatabase
  
getReference(path:String = null):DatabaseReference
Gets a DatabaseReference for the provided path.
FirebaseDatabase
  
Gets a DatabaseReference for the provided URL.
FirebaseDatabase
  
getSdkVersion():String
The version for this build of the Firebase Database client
FirebaseDatabase
  
goOffline():void
Shuts down the connection to the Firebase Database backend until goOnline() is called.
FirebaseDatabase
  
goOnline():void
Resumes the connection to the Firebase Database backend after a previous goOffline() call.
FirebaseDatabase
  
init(key:String):void
Deprecated: You no longer need to call this function or use an application key
[static] Initialises the extension class for use with the provided key.
FirebaseDatabase
  
The Firebase Database client automatically queues writes and sends them to the server at the earliest opportunity, depending on network connectivity.
FirebaseDatabase
  
setDatabaseUrl(databaseUrl:String):void
Set the url for the database to access
FirebaseDatabase
  
setPersistenceEnabled(enabled:Boolean):Boolean
The Firebase Database client will cache synchronized data and keep track of all writes you've initiated while your application is running.
FirebaseDatabase
Public Constants
 ConstantDefined By
  EXT_CONTEXT_ID : String = com.distriqt.firebase.Database
[static]
FirebaseDatabase
  VERSION : String = 10.1.0
[static]
FirebaseDatabase
Property Detail
implementationproperty
implementation:String  [read-only]

The implementation currently in use. This should be one of the following depending on the platform in use and the functionality supported by this extension:


Implementation
    public function get implementation():String
instanceproperty 
instance:FirebaseDatabase  [read-only]

The singleton instance of the FirebaseDatabase class.


Implementation
    public static function get instance():FirebaseDatabase

Throws
Error — If there was a problem creating or accessing the extension, or if the key is invalid
isSupportedproperty 
isSupported:Boolean  [read-only]

Whether the current device supports the extensions functionality


Implementation
    public static function get isSupported():Boolean
nativeVersionproperty 
nativeVersion:String  [read-only]

The native version string of the native extension.


Implementation
    public function get nativeVersion():String
serviceproperty 
service:FirebaseDatabase  [read-only]

The singleton instance of the FirebaseDatabase class.


Implementation
    public static function get service():FirebaseDatabase

Throws
Error — If there was a problem creating or accessing the extension, or if the key is invalid
versionproperty 
version:String  [read-only]

The version of this extension. This will be of the format, MAJOR.MINOR.BUILD


Implementation
    public function get version():String
Constructor Detail
FirebaseDatabase()Constructor
public function FirebaseDatabase()

Constructor You should not call this directly, but instead use the singleton access

Method Detail
dispose()method
public function dispose():void

Disposes the extension and releases any allocated resources. Once this function has been called, a call to init is neccesary again before any of the extensions functionality will work.

disposeUnusedReferences()method 
public function disposeUnusedReferences():void

During the course of using the Firebase Realtime Database extension you will be creating and destroying references and queries that may not get immediately disposed. If you need to manage memory and remove some items you can call this function to dispose any references and queries that have been created and do not have active event listeners. You should make sure that any references you are holding onto either have an event listener or are released after calling this function.

getReference()method 
public function getReference(path:String = null):DatabaseReference

Gets a DatabaseReference for the provided path.

Parameters

path:String (default = null) — Path to a location in your FirebaseDatabase.

Returns
DatabaseReference — A DatabaseReference pointing to the specified path.
getReferenceFromUrl()method 
public function getReferenceFromUrl(url:String):DatabaseReference

Gets a DatabaseReference for the provided URL. The URL must be a URL to a path within this FirebaseDatabase. To create a DatabaseReference to a different database, create a FirebaseApp with a FirebaseOptions object configured with the appropriate database URL.

Parameters

url:String — A URL to a path within your database.

Returns
DatabaseReference — A DatabaseReference for the provided URL.
getSdkVersion()method 
public function getSdkVersion():String

The version for this build of the Firebase Database client

Returns
String
goOffline()method 
public function goOffline():void

Shuts down the connection to the Firebase Database backend until goOnline() is called.

goOnline()method 
public function goOnline():void

Resumes the connection to the Firebase Database backend after a previous goOffline() call.

init()method 
public static function init(key:String):void
Deprecated: You no longer need to call this function or use an application key

Initialises the extension class for use with the provided key.

Parameters

key:String


Throws
Error — If there was a problem creating or accessing the extension, or if the key is invalid
purgeOutstandingWrites()method 
public function purgeOutstandingWrites():void

The Firebase Database client automatically queues writes and sends them to the server at the earliest opportunity, depending on network connectivity. In some cases (e.g. offline usage) there may be a large number of writes waiting to be sent. Calling this method will purge all outstanding writes so they are abandoned. All writes will be purged, including transactions and onDisconnect() writes. The writes will be rolled back locally, perhaps triggering events for affected event listeners, and the client will not (re-)send them to the Firebase backend.

setDatabaseUrl()method 
public function setDatabaseUrl(databaseUrl:String):void

Set the url for the database to access

Parameters

databaseUrl:String

setPersistenceEnabled()method 
public function setPersistenceEnabled(enabled:Boolean):Boolean

The Firebase Database client will cache synchronized data and keep track of all writes you've initiated while your application is running. It seamlessly handles intermittent network connections and re-sends write operations when the network connection is restored. However by default your write operations and cached data are only stored in-memory and will be lost when your app restarts. By setting this value to `true`, the data will be persisted to on-device (disk) storage and will thus be available again when the app is restarted (even when there is no network connectivity at that time). Note that this method must be called before creating your first Database reference and only needs to be called once per application.

Parameters

enabled:Boolean — Set to true to enable disk persistence, set to false to disable it

Returns
Boolean — true if successful and false if the extension is in an invalid state
Constant Detail
EXT_CONTEXT_IDConstant
public static const EXT_CONTEXT_ID:String = com.distriqt.firebase.Database

VERSIONConstant 
public static const VERSION:String = 10.1.0