File tree Expand file tree Collapse file tree 1 file changed +21
-8
lines changed Expand file tree Collapse file tree 1 file changed +21
-8
lines changed Original file line number Diff line number Diff line change
1
+ import featherIcons from 'feather-vue'
2
+
1
3
// plugins
2
4
import Components from './components'
3
5
@@ -14,27 +16,38 @@ const mixins = { validatable, resettable }
14
16
export const Clair = {
15
17
mixins,
16
18
install ( Vue ) {
19
+ const VuePrototype = Vue . prototype
20
+ const defineReadOnly = function ( key , val ) {
21
+ Object . defineProperty ( VuePrototype , key , {
22
+ get ( ) {
23
+ return val
24
+ } ,
25
+ configurable : process . env . NODE_ENV !== 'production' ,
26
+ enumerable : false
27
+ } )
28
+ }
29
+
30
+ // set a noop utility
31
+ defineReadOnly ( 'noop' , _ => _ )
32
+
17
33
// inject $clair to Vue prototype
18
- if ( ! ( '$clair' in Vue . prototype ) ) {
34
+ if ( ! ( '$clair' in VuePrototype ) ) {
19
35
const $clair = new Vue ( {
20
36
data : {
21
37
responsive : null ,
22
38
defaultThrottleTime : 150
23
39
}
24
40
} )
25
41
$clair . mixins = mixins
26
-
27
- Object . defineProperty ( Vue . prototype , '$clair' , {
28
- get ( ) {
29
- return $clair
30
- }
31
- } )
42
+ defineReadOnly ( '$clair' , $clair )
32
43
}
33
44
34
- Vue . prototype . noop = ( ) => { }
45
+ // expose featherIcons for convenience
46
+ defineReadOnly ( '$featherIcons' , featherIcons )
35
47
36
48
// register components
37
49
Vue . use ( Components )
50
+
38
51
// install plugins
39
52
Vue . use ( Modal )
40
53
Vue . use ( Responsive )
You can’t perform that action at this time.
0 commit comments