Use the native Firebase SDK in Axway Titanium. This repository is part of the Titanium Firebase project.
- The Firebase Core module
- Titanium SDK 6.3.0+
- Property format nested lists in this Readme
-
getReference(arguments)->FirebaseDatabaseReference -identifier(String),path(String) ORurl(String)  -observableEvents([DATA_EVENT_TYPE_*]) -
getFirebaseServerTimestamp()
-
child(arguments)->FirebaseDatabaseReferenceidentifier(String),path(String) ORurl(String) Â -observableEvents([DATA_EVENT_TYPE_*])
-
childByAutoId(arguments)->FirebaseDatabaseReferenceidentifier(String),path(String) ORurl(String) Â -observableEvents([DATA_EVENT_TYPE_*])
-
root(arguments)->FirebaseDatabaseReference -observableEvents([DATA_EVENT_TYPE_*]) -
parent(arguments)->FirebaseDatabaseReferenceobservableEvents([DATA_EVENT_TYPE_*])
-
setValue(value, callback)value(Any) Â -callback(optional, Function)
-
removeValue(callback)Â -callback(optional, Function) -
updateChildValues(childValues, callback)Â -childValues(Dictionary) Â -callback(optional, Function) -
setPriority(priority, callback)Â -priority(Any) Â -callback(optional, Function) -
goOnline() -
goOffline() -
keepSynced(synced)Â -synced(Boolean)
-
key(String) -
url(String)
DATA_EVENT_TYPE_VALUEDATA_EVENT_TYPE_CHILD_ADDEDDATA_EVENT_TYPE_CHILD_CHANGEDDATA_EVENT_TYPE_CHILD_MOVEDDATA_EVENT_TYPE_CHILD_REMOVED
Important note: Events are added and removed generically. They are only fired if you observe them via
the observableEvents parameter.
value(viaDATA_EVENT_TYPE_VALUE)add(viaDATA_EVENT_TYPE_CHILD_ADDED)change(viaDATA_EVENT_TYPE_CHILD_CHANGED)move(viaDATA_EVENT_TYPE_CHILD_MOVED)remove(viaDATA_EVENT_TYPE_CHILD_REMOVED)
// Require the Firebase Database module
var FirebaseDatabase = require('firebase.database');
// Inserting values in firebase database
var fdRef = FirebaseDatabase.getReference().childByAutoId({
path: 'user'
});
fdRef.setValue({
username: 'username',
email: '[email protected]',
password: 'ABCXYZ',
timestamp: FirebaseDatabase.getFirebaseServerTimestamp()
}, function(e) {
Ti.API.info('Value written, snapshot: ' + JSON.stringify(e, null, 4));
});
// Fetching values from Firebase database
var userRef = FirebaseDatabase.getReference({
path: 'user',
observableEvents: [FirebaseDatabase.DATA_EVENT_TYPE_CHILD_ADDED, FirebaseDatabase.DATA_EVENT_TYPE_VALUE]
});
userRef.addEventListener('value', function(e) {
Ti.API.info('DATA_EVENT_TYPE_VALUE, snapshot: ' + JSON.stringify(e, null, 4));
});
userRef.addEventListener('add', function(e) {
Ti.API.info('DATA_EVENT_TYPE_CHILD_ADDED, snapshot: ' + JSON.stringify(e, null, 4));
});cd ios
appc run -p ios --build-onlyThis module is Copyright (c) 2018-present by Hans Knöchel, Inc. All Rights Reserved.