Skip to content

Commit 515b68e

Browse files
committed
refactor(build): use object style author
1 parent 8f462b1 commit 515b68e

File tree

4 files changed

+190
-134
lines changed

4 files changed

+190
-134
lines changed

Diff for: build/build.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const packageData = require('../package.json')
55
const mkdirp = require('mkdirp')
66
const { version, author, name } = packageData
77
// remove the email at the end
8-
const authorName = author.replace(/\s+<.*/, '')
8+
const authorName = author.name
99
const moduleName = 'Vuefire'
1010

1111
// Make sure dist dir exists

Diff for: examples/index.html

+97-101
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="utf-8">
5-
<title>VueFire Todo App Demo</title>
6-
<script src="https://www.gstatic.com/firebasejs/4.6.0/firebase.js"></script>
7-
<script src="https://www.gstatic.com/firebasejs/4.6.0/firebase-firestore.js"></script>
8-
<script src="https://unpkg.com/vue"></script>
9-
<script src="../dist/vuefire.js"></script>
10-
</head>
11-
<body>
12-
13-
<!--
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<title>VueFire Todo App Demo</title>
7+
<script src="https://www.gstatic.com/firebasejs/4.6.0/firebase.js"></script>
8+
<script src="https://www.gstatic.com/firebasejs/4.6.0/firebase-firestore.js"></script>
9+
<script src="https://unpkg.com/vue"></script>
10+
<script src="../dist/vuefire.js"></script>
11+
</head>
12+
13+
<body>
14+
15+
<!--
1416
Before running this example, make sure to:
1517
1618
1. cd path/to/vuefire
@@ -25,100 +27,94 @@
2527
https://jsfiddle.net/posva/wtyop5jy/
2628
-->
2729

28-
<div id="app">
29-
<button @click="toggleTodos">Toggle todos</button>
30-
<br/>
31-
<input
32-
v-model.trim="newTodoText"
33-
@keyup.enter="addTodo"
34-
placeholder="Add new todo"
35-
>
36-
<ul>
37-
<li v-for="todo in todos">
38-
<input
39-
:value="todo.text"
40-
@input="updateTodoText(todo, $event.target.value)"
41-
>
42-
<button @click="removeTodo(todo)">X</button>
43-
</li>
44-
</ul>
45-
46-
<h4>collection with refs</h4>
47-
48-
<ul>
49-
<li v-for="moment in moments">{{ moment }}</li>
50-
</ul>
51-
52-
<h5>Original data</h5>
53-
54-
<ul>
55-
<li v-for="tweet in tweets">{{ tweet }}</li>
56-
</ul>
57-
58-
<p>config: </p>
59-
<pre>
30+
<div id="app">
31+
<button @click="toggleTodos">Toggle todos</button>
32+
<br/>
33+
<input v-model.trim="newTodoText" @keyup.enter="addTodo" placeholder="Add new todo">
34+
<ul>
35+
<li v-for="todo in todos">
36+
<input :value="todo.text" @input="updateTodoText(todo, $event.target.value)">
37+
<button @click="removeTodo(todo)">X</button>
38+
</li>
39+
</ul>
40+
41+
<h4>collection with refs</h4>
42+
43+
<ul>
44+
<li v-for="moment in moments">{{ moment }}</li>
45+
</ul>
46+
47+
<h5>Original data</h5>
48+
49+
<ul>
50+
<li v-for="tweet in tweets">{{ tweet }}</li>
51+
</ul>
52+
53+
<p>config: </p>
54+
<pre>
6055
{{ config }}
6156
</pre>
62-
</div>
63-
64-
<script>
65-
/* global Vue, firebase, Vuefire */
66-
Vue.use(Vuefire.default)
67-
firebase.initializeApp({
68-
projectId: 'vue-fire-store',
69-
databaseURL: 'https://vue-fire-store.firebaseio.com'
70-
})
71-
const db = firebase.firestore()
72-
const todos = db.collection('todos')
73-
const unFinishedTodos = todos.where('finished', '==', false)
74-
const finishedTodos = todos.where('finished', '==', true)
75-
const config = db.collection('configs').doc('jORwjIykFo2NmkdzTkhU')
76-
77-
new Vue({
78-
el: '#app',
79-
data: {
80-
todos: [],
81-
tweets: [],
82-
moments: [],
83-
config: null,
84-
newTodoText: ''
85-
},
57+
</div>
8658

87-
firestore: {
88-
todos: unFinishedTodos,
89-
moments: db.collection('moments'),
90-
tweets: db.collection('tweets'),
91-
config
92-
},
59+
<script>
60+
/* global Vue, firebase, Vuefire */
61+
Vue.use(Vuefire)
62+
firebase.initializeApp({
63+
projectId: 'vue-fire-store',
64+
databaseURL: 'https://vue-fire-store.firebaseio.com'
65+
})
66+
const db = firebase.firestore()
67+
const todos = db.collection('todos')
68+
const unFinishedTodos = todos.where('finished', '==', false)
69+
const finishedTodos = todos.where('finished', '==', true)
70+
const config = db.collection('configs').doc('jORwjIykFo2NmkdzTkhU')
71+
72+
new Vue({
73+
el: '#app',
74+
data: {
75+
todos: [],
76+
tweets: [],
77+
moments: [],
78+
config: null,
79+
newTodoText: ''
80+
},
81+
82+
firestore: {
83+
todos: unFinishedTodos,
84+
moments: db.collection('moments'),
85+
tweets: db.collection('tweets'),
86+
config
87+
},
9388

94-
methods: {
95-
addTodo: function () {
96-
if (this.newTodoText) {
97-
todos.add({
98-
finished: false,
99-
text: this.newTodoText,
100-
created: firebase.firestore.FieldValue.serverTimestamp()
101-
})
102-
this.newTodoText = ''
103-
}
104-
},
105-
updateTodoText: function (todo, newText) {
106-
todos.doc(todo.id).update({ text: newText })
107-
},
108-
removeTodo: function (todo) {
109-
todos.doc(todo.id).delete()
110-
},
111-
toggleTodos () {
112-
console.log(this.$firestoreRefs.todos === unFinishedTodos)
113-
this.$bind(
114-
'todos',
115-
this.$firestoreRefs.todos === unFinishedTodos
116-
? finishedTodos
117-
: unFinishedTodos
118-
)
89+
methods: {
90+
addTodo: function () {
91+
if (this.newTodoText) {
92+
todos.add({
93+
finished: false,
94+
text: this.newTodoText,
95+
created: firebase.firestore.FieldValue.serverTimestamp()
96+
})
97+
this.newTodoText = ''
11998
}
99+
},
100+
updateTodoText: function (todo, newText) {
101+
todos.doc(todo.id).update({ text: newText })
102+
},
103+
removeTodo: function (todo) {
104+
todos.doc(todo.id).delete()
105+
},
106+
toggleTodos: function () {
107+
console.log(this.$firestoreRefs.todos === unFinishedTodos)
108+
this.$bind(
109+
'todos',
110+
this.$firestoreRefs.todos === unFinishedTodos
111+
? finishedTodos
112+
: unFinishedTodos
113+
)
120114
}
121-
})
122-
</script>
123-
</body>
115+
}
116+
})
117+
</script>
118+
</body>
119+
124120
</html>

0 commit comments

Comments
 (0)