Comments (5)
The mainly used feature is Analytics, but if you want to implement Realtime Databases as well, please propose an API, so the community can discuss it.
from titanium-firebase.
This is my proposal:
Following https://firebase.google.com/docs/database/android/start/
var ref = require("firebase.database").createDatabaseReference('message'); // make an instance
ref.setValue('Hello TitaniumWorld');
ref.addEventlistener('changed',function(e){
})
from titanium-firebase.
Here is mine:
var FirebaseDatabase = require('firebase.database');
var reference = FirebaseDatabase.getReference('message');
reference.addEventListener('change', function(e) {
var value = e.snapshot.getValue({
type: 'String'
});
Ti.API.info(value);
});
reference.addEventListener('cancel', function(e) {
Ti.API.info(e.error);
});
reference.setValue('Titanium rocks!');
Basically your version, but with some changes:
- Other API naming to be more consistent
- Use present-sense for events (change vs changed) to match common Node / Titanium event naming convention
- Add cancel event
- Add "getValue" method that makes it possible to pass a type that on the native side can then be mapped to "String.class" for example
If you are able to do Android, I'll provide iOS.
from titanium-firebase.
very good ideas. I used createDatabaseReference
because of native name. But getReference
is fine. I think you don't think about a proxy?
from titanium-firebase.
nope, proxies are not necessary and even a bad idea, because they collide with the concepts of shared objects / singletons. We do not and should not need to retain any reference as we can receive a fresh copy every time we call getReference
.
P.S.: I am implementing the iOS part now, will be available later today. Watch out for https://github.com/hansemannn/titanium-firebase-database
EDIT: Of course we need proxies to me more flexible on the APIs and not wrap everything into a dictionary. But we should be cautious storing strong references it it that may cause persistence- and integrity-issues.
from titanium-firebase.
Related Issues (18)
- java.lang.IllegalStateException at com.google.firebase.FirebaseApp.getInstance HOT 1
- Android Firebase.core crash app HOT 2
- NoClassDefFoundError HOT 2
- Runing application simulator getting issue HOT 2
- Link to Ti.Firestore project from README HOT 2
- Duplicate class build error when using firebase.core and firebase.auth
- iOS 14 IDFA permissions HOT 1
- Consider moving to BoM
- Error after upgrading to 6.0.0 Android
- Update Firebase iOS to v 8.X HOT 4
- Suggestion: List module versions in the readme HOT 6
- Any plans to include the missing android versions? HOT 1
- Getting Exception HOT 3
- Default app has already been configured HOT 1
- Does it work for Firestore too ? HOT 3
- Getting an exception : ERR_INVALID_CALLBACK HOT 2
- Uncaught translation error: java.lang.IllegalArgumentException HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from titanium-firebase.