Packagecom.myflashlab.air.extensions.firebase.db
Classpublic class DB
InheritanceDB Inheritance Object

The entry point for accessing a Firebase Database. You can initialize Firebase database by calling DB.init(). To access a location in the database and read or write data, use DB.getReference().



Public Properties
 PropertyDefined By
  persistenceEnabled : Boolean
[static] [write-only] The Firebase Database client will cache synchronized data and keep track of all writes you've initiated while your application is running.
DB
  sdkVersion : String
[static] [read-only] The server version for this build of the Firebase Database client
DB
Public Methods
 MethodDefined By
  
[static] Call this method so the ANE can consider all db related instances for garbage collection.
DB
  
getReference($path:String = null):DBReference
[static] Gets a new DBReference instance.
DB
  
goOffline():void
[static] Shuts down our connection to the Firebase Database backend until goOnline() is called.
DB
  
goOnline():void
[static] Resumes our connection to the Firebase Database backend after a previous goOffline() call.
DB
  
init(url:String = null):void
[static] Call this method prior to any other DB methods.
DB
  
[static] The Firebase Database client automatically queues writes and sends them to the server at the earliest opportunity, depending on network connectivity.
DB
Public Constants
 ConstantDefined By
  EXTENSION_ID : String = com.myflashlab.air.extensions.firebase.realtimeDB
[static]
DB
  LOGGER_LEVEL_DEBUG : int = 1
[static]
DB
  LOGGER_LEVEL_ERROR : int = 2
[static]
DB
  LOGGER_LEVEL_INFO : int = 3
[static]
DB
  LOGGER_LEVEL_NONE : int = 5
[static]
DB
  LOGGER_LEVEL_WARN : int = 4
[static]
DB
  VERSION : String = 9.9.0
[static]
DB
Property Detail
persistenceEnabledproperty
persistenceEnabled:Boolean  [write-only]

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.


Implementation
    public static function set persistenceEnabled(value:Boolean):void
sdkVersionproperty 
sdkVersion:String  [read-only]

The server version for this build of the Firebase Database client


Implementation
    public static function get sdkVersion():String
Method Detail
cleanAllReferences()method
public static function cleanAllReferences():void

Call this method so the ANE can consider all db related instances for garbage collection. You need to call this method from time to time to avoid too many empty references staying at your app with no use. However, remember to call this method ONLY when you don't have an active database operation in progress. Calling this method when your app is interacting with server will break your app. When you call this method, All database references and listeners will broke. You will need to create new references after this method is called.

getReference()method 
public static function getReference($path:String = null):DBReference

Gets a new DBReference instance. Refrence for the provided path if you set the $path parameter.

Parameters

$path:String (default = null)

Returns
DBReference
goOffline()method 
public static function goOffline():void

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

goOnline()method 
public static function goOnline():void

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

init()method 
public static function init(url:String = null):void

Call this method prior to any other DB methods.

Parameters

url:String (default = null) — The URL to the Firebase Database instance you want to access. Default value is null

purgeOutstandingWrites()method 
public static 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.

Constant Detail
EXTENSION_IDConstant
public static const EXTENSION_ID:String = com.myflashlab.air.extensions.firebase.realtimeDB

LOGGER_LEVEL_DEBUGConstant 
public static const LOGGER_LEVEL_DEBUG:int = 1

LOGGER_LEVEL_ERRORConstant 
public static const LOGGER_LEVEL_ERROR:int = 2

LOGGER_LEVEL_INFOConstant 
public static const LOGGER_LEVEL_INFO:int = 3

LOGGER_LEVEL_NONEConstant 
public static const LOGGER_LEVEL_NONE:int = 5

LOGGER_LEVEL_WARNConstant 
public static const LOGGER_LEVEL_WARN:int = 4

VERSIONConstant 
public static const VERSION:String = 9.9.0