Skip to content

ebeeson/firebase-utils

Repository files navigation

firebase-utils

My tiny utility extensions to the Firebase Javascript SDK.

Untested, unsupported; use at your own risk.

ko.firebase.js

Map a primitive value stored in a Firebase ref to a Knockout observable.

Similar to knockoutFire or knockout-sync except instead of starting with observables and bolting on synchronization, ko.firebase produces observables directly from Firebase instances. The result is an observables (or observablesArray) that stay in sync with Firebase for both reads and writes.

It extends Firebase instances to add methods to get a knockout observable (for primitive values) or an observableArray of observables (for sets of primitives) from a Firebase location:

var firebase = new Firebase('...');
var foobarObservable = firebase.child('foobar').asObservable();
// or: var foobarObservable = ko.firebase.observable(firebase.child('foobar'));

Which means you can end up with a bidirectionally synchronized textfield with just:

...
<input type="text" data-bind="value: foobar">
...
ko.applyBindings({
	foobar: foobarObservable
});

firebase-utils.js

An assortment of little Firebase things that I find useful.

About

My tiny utility extensions to the Firebase Javascript SDK.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published