Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Conversation

@mbleigh
Copy link
Contributor

@mbleigh mbleigh commented Mar 28, 2015

This is incomplete work toward 0.8 compatibility for firebase-element. I'm submitting it as a pull request to start discussion about some of the things that may need to change.

Presently demos/firebase.html will load data but doesn't persist it -- at all. I think I may not understand how Polymer 0.8 property binding works when trying to use standard <form> elements, so any insight would be appreciated.

I also ended up needing to load observe.js separately since I don't think it's part of Polymer anymore. Since 0.8 is moving away from Object.observe, should another solution be used in its place for firebase-element?

In any case, WIP feel free to poke around.

@addyosmani
Copy link
Contributor

cc @kevinpschaaf

@mbleigh
Copy link
Contributor Author

mbleigh commented Apr 7, 2015

After some consideration, I don't think it probably makes sense to port the existing paradigm for firebase-element to 0.8. Right now my guess for a best-bet would actually be to make a Polymer mixin for Firebase that allowed you to bind to specific properties. Something like:

Polymer({
  is: "app-user",
  mixins: [PolymerFire({
    base: "https://example.firebaseio.com/users",
    properties: ["name", "email"],
    locationProperty: "id"
  })],
  properties: {name: String, email: String},
  created: function(){ this.bindRef() }
});

Where the mixin is a factory that takes the properties to bind as well as a property that can serve as a dynamic location identifier.

I'll probably build this regardless of the direction of firebase-element, just thought I'd share.

@mbleigh
Copy link
Contributor Author

mbleigh commented Apr 8, 2015

As promised, I couldn't resist building out a prototype of my suggestion above: https://github.com/divshot/polymerfire

I think this is probably a more idiomatic way to approach Firebase data in a Polymer 0.8 world (without Object.observe it seems almost impossible to have a "zero JS" way to bind).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants