alexbain / backbone-firebase Goto Github PK
View Code? Open in Web Editor NEWBackbone extension to use Firebase as a backend
Backbone extension to use Firebase as a backend
Hi alex, thanks for the really useful library.
Something that through me when I was getting up and running with it, was how there is no need to call fetch when instantiating a collection.
After this runs
notes = new Notes()
board = new Board(model: notes).render().$el.appendTo('body')
the appropriate events on the collection start firing
initialize: ->
@model.bind 'add', @addModel, @
So I guess this isn't an issue as such but maybe something to add to the docs
Model URL is a bit awkward. The model must declare a URL, but what should that be?
If I put something like this:
Backbone.Model.extend({ url: 'users/' });
Then Backbone.sync( 'create' ... )
will work fine. But a read/update/delete will modify the parent tree (oops).
I can add a function, but the function will have to know what operation is taking place on it. Because for create
it needs to return the url path of the parent (e.g. users/
), but for update
, read
and delete
ops, it needs to return something like users/my_unique_id
I'll add a commit to my PR to make Backbone.sync take care of suffixing the record ID as needed, so that all the model needs to understand is what it's table name (parent path) is.
It looks like Backbone.sync() will fail unless the model has a
url` attribute](https://github.com/alexbain/backbone-firebase/blob/master/backbone-firebase.js#L121).
That should probably be added to the readme example?
this.reference
is declared on line 22 (with default URL) and then again on line 33, creating two Firebase instances (double overhead).
urlError
is invoked on line 121, but does not exist
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.