File tree Expand file tree Collapse file tree 2 files changed +28
-12
lines changed Expand file tree Collapse file tree 2 files changed +28
-12
lines changed Original file line number Diff line number Diff line change 21
21
"test" : " echo 'no tests!' && npm run lint" ,
22
22
"prepublish" : " npm run build" ,
23
23
"lint" : " xo" ,
24
- "build" : " bili --format cjs --format umd --compress --banner --js babel && node-sass themes/ -o themes/" ,
24
+ "build" : " bili --external=vue -- format cjs --format umd --compress --banner --js babel && node-sass themes/ -o themes/" ,
25
25
"build:example" : " poi build" ,
26
26
"dev" : " poi --port 5000" ,
27
27
"deploy" : " npm run build:example && gh-pages -d example/dist"
28
28
},
29
29
"author" :
" cristij <[email protected] >" ,
30
30
"license" : " MIT" ,
31
31
"dependencies" : {},
32
+ "peerDependencies" : {
33
+ "vue" : " ^2.2.0"
34
+ },
32
35
"devDependencies" : {
33
36
"babel-preset-vue-app" : " ^2.0.0" ,
34
37
"bili" : " ^0.16.0-rc.2" ,
Original file line number Diff line number Diff line change 1
1
import Notifications from './Notifications.js'
2
+ import Vue from 'vue' ;
2
3
3
4
const NotificationStore = {
4
5
state : [ ] , // here the notifications will be added
@@ -59,16 +60,28 @@ function initStore(Vue){
59
60
} ) ;
60
61
}
61
62
62
- const NotificationsPlugin = {
63
- install ( Vue , options ) {
64
- let store = initStore ( Vue ) ;
65
- Vue . prototype . $notify = store . notify ;
66
- Vue . prototype . $notifications = store . notificationStore ;
67
- Vue . component ( 'Notifications' , Notifications )
68
- if ( options ) {
69
- NotificationStore . setOptions ( options )
70
- }
71
- }
63
+ export const Notification = new class {
64
+ constructor ( ) {
65
+ this . store = initStore ( Vue ) ;
66
+ }
67
+
68
+ notify ( ...params ) {
69
+ this . store . notify ( params )
70
+ }
71
+
72
+ notifications ( ) {
73
+ return this . store . notificationStore ;
74
+ }
72
75
} ;
73
76
74
- export default NotificationsPlugin
77
+ export default {
78
+ install ( Vue , options ) {
79
+ let store = initStore ( Vue ) ;
80
+ Vue . prototype . $notify = store . notify ;
81
+ Vue . prototype . $notifications = store . notificationStore ;
82
+ Vue . component ( 'Notifications' , Notifications ) ;
83
+ if ( options ) {
84
+ NotificationStore . setOptions ( options )
85
+ }
86
+ }
87
+ }
You can’t perform that action at this time.
0 commit comments