ebeeson / firebase-utils

My tiny utility extensions to the Firebase Javascript SDK.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

License:The Unlicense


Languages

Language:JavaScript 100.0%