Skip to content

Latest commit

 

History

History

x-gwt-firebase

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Firebase

What does Firebase do ?

Just a firebase wrapper.

How use it ?

  • Add js library as you want, like :
<script src="bower_components/firebase/firebase.js"></script>
  • Add maven dependency :
<dependency>
    <groupId>com.github.spirylics.xgwt</groupId>
    <artifactId>x-gwt-firebase</artifactId>
    <version>XXX</version>
</dependency>
  • Add gwt module :
<inherits name="com.github.spirylics.xgwt.Firebase"/>
  • Based on gwt-jackson, initialize json mapping such as :
XMapper.addMappers(ImmutableMap.of(Foo.class, GWT.<ObjectMapper>create(FooMapper.class));
  • Initialize Firebase :
Config config = new Config();
config.setApiKey("####");
config.setAuthDomain("####");
config.setDatabaseURL("####");
config.setStorageBucket("####");
Firebase firebase = Firebase.initializeApp(config);
  • Get foo :
Reference reference = getFirebase().database().ref().xChild("foo", "1");
reference.xOnce(Event.value).then(
    fooSnapshot -> { Foo foo = starSnapshot.val(Foo.class); }, 
    err -> logger.severe(":(" + err));