forked from bmass02/FireComponent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
63 lines (54 loc) · 1.56 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import FireHtml from './src/components/FireHtml.vue';
import FireText from './src/components/FireText.vue';
import FireImage from './src/components/FireImage.vue';
import FireInput from './src/components/FireInput.vue';
import firebase from 'firebase';
import VueProgressiveImage from 'vue-progressive-image';
// Install the components
export function install (Vue, options) {
if (typeof options === 'object') {
// @param options can be either a firebase object itself
// or otherwise a firebase config object
if (options.databaseURL !== undefined) {
firebase.initializeApp(options);
Vue.prototype.$firebase = firebase;
} else {
Vue.prototype.$firebase = options;
}
} else {
console.error('You must add your firebase configuration object to the firecomponent library');
return;
}
Vue.use(VueProgressiveImage);
Vue.component('fire-text', FireText);
Vue.component('fire-html', FireHtml);
Vue.component('fire-image', FireImage);
Vue.component('fire-input', FireInput);
}
// Expose the components
export {
FireHtml,
FireText,
FireImage,
FireInput
};
/* -- Plugin definition & Auto-install -- */
/* You shouldn't have to modify the code below */
// Plugin
var plugin = {
/* eslint-disable no-undef */
install: install
};
export default plugin;
// Auto-install
var GlobalVue = null;
if (typeof window !== 'undefined') {
GlobalVue = window.Vue;
} else if (typeof global !== 'undefined') {
GlobalVue = global.Vue;
}
if (GlobalVue) {
GlobalVue.initializeApp = function (config) {
Vue.use(plugin, config);
};
}