Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bower_components
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
firebase-element
================

See the [component page](http://polymer.github.io/firebase-element) for more information.
See the [component page](http://polymerelements.github.io/firebase-element) for more information.

firebase-import
===============
firebase.html
=============

Import files are a new invention, so libraries like [`firebase`](http://firebase.com) do not yet provide them.

`firebase-import` is an intermediary that provides an import file for the `firebase` component. `firebase-import` depends on `firebase`.
`firebase.html` is an intermediary that provides an import file for the `firebase` component. `firebase.html` depends on `firebase`.

Components that want to use `firebase` should depend on `firebase-element` and import `firebase-import` to be safe from library duplication.
Components that want to use `firebase` should depend on `firebase-element` and import `firebase.html` to be safe from library duplication.
Such components need not use Polymer or `firebase-element`, but we put the import and the element in one package for convenience.
10 changes: 8 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"name": "firebase-element",
"version": "0.8.0",
"private": true,
"dependencies": {
"polymer": "Polymer/polymer#master",
"firebase": "^2.2"
"polymer": "polymer/polymer#v0.8.0-rc.6",
"firebase": "^2.2.0"
},
"devDependencies": {
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.6.0",
"iron-doc-viewer": "polymerelements/iron-doc-viewer#^0.8.0",
"web-component-tester": "*"
}
}
13 changes: 0 additions & 13 deletions demo.html

This file was deleted.

26 changes: 26 additions & 0 deletions demo/firebase.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>

<title>firebase-element</title>

<script src="../../webcomponentsjs/webcomponents-lite.js"></script>

<link rel="import" href="x-firebase.html">

</head>
<body>

<x-firebase></x-firebase>

</body>
</html>
13 changes: 13 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<a href="firebase.html">firebase-element</a>
<br>
<a href="login.html">firebase-login</a>
<br>
33 changes: 33 additions & 0 deletions demo/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>

<title>firebase-login</title>

<script src="../../webcomponentsjs/webcomponents-lite.js"></script>

<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="x-login.html">

<style>
input:not([type]) {
width: 250px;
}
</style>

</head>
<body>

<x-login></x-login>

</body>
</html>
95 changes: 95 additions & 0 deletions demo/x-firebase.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../firebase-element.html">
<link rel="import" href="../firebase.html">
<dom-module id="x-firebase">
<template>
<firebase-element id="base" on-data-change="onDataChange" data="{{data}}" location="https://treedata-demo.firebaseio.com/demo" log></firebase-element>

<h3>Top-level properties persist automatically:</h3>

<input value="{{data.name::input}}">
<br>
<input value="{{data.info::input}}">

<hr>

<h3>Nested properties must be persisted manually:</h3>

<input value="{{data.more.color::input}}">

<button on-tap="onCommitMore">Commit data.more</button>

<hr>

<h3>Remote Data</h3>
<pre>{{json}}</pre>

<hr>

<button on-tap="onResetLocal">Reset Local</button>
<button on-tap="onRemoveLocal">Remove Local</button>
<button on-tap="onResetRemote">Reset remote</button>
<button on-tap="onRemoveRemote">Remove Remote</button>

</template>
</dom-module>
<script>
Polymer({
is: 'x-firebase',

properties: {
data: {
type: Object,
notify: true,
observer: 'dataChanged'
},

json: {
type: Object
}
},

onResetLocal: function() {
// direct setting of data is persisted automatically
this.data = {
name: 'anonymous',
info: 'none',
more: {
color: "yellow"
}
};
},

onRemoveLocal: function() {
this.data = null;
},

onResetRemote: function() {
// Simulate other actor setting data to same remote location
new Firebase('https://treedata-demo.firebaseio.com/demo').set({
name: 'anonymous',
info: 'none',
more: {
color: "yellow"
}
});
},

onCommitMore: function() {
this.$.base.commitProperty('more');
},

dataChanged: function() {
this.json = JSON.stringify(this.data, null, ' ');
}
});
</script>
Loading