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 2121 "test" : " echo 'no tests!' && npm run lint" ,
2222 "prepublish" : " npm run build" ,
2323 "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/" ,
2525 "build:example" : " poi build" ,
2626 "dev" : " poi --port 5000" ,
2727 "deploy" : " npm run build:example && gh-pages -d example/dist"
2828 },
2929 "author" :
" cristij <[email protected] >" ,
3030 "license" : " MIT" ,
3131 "dependencies" : {},
32+ "peerDependencies" : {
33+ "vue" : " ^2.2.0"
34+ },
3235 "devDependencies" : {
3336 "babel-preset-vue-app" : " ^2.0.0" ,
3437 "bili" : " ^0.16.0-rc.2" ,
Original file line number Diff line number Diff line change 11import Notifications from './Notifications.js'
2+ import Vue from 'vue' ;
23
34const NotificationStore = {
45 state : [ ] , // here the notifications will be added
@@ -59,16 +60,28 @@ function initStore(Vue){
5960 } ) ;
6061}
6162
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+ }
7275} ;
7376
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