-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
notifications
- Loading branch information
wangzhao
committed
Aug 1, 2018
1 parent
2edc04b
commit 013caca
Showing
11 changed files
with
129 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,42 @@ | ||
exports.hello = '18'; | ||
// exports.hello = '18'; | ||
|
||
// console.log(module); | ||
// console.log(process); | ||
// // console.log(module); | ||
// // console.log(process); | ||
|
||
const EventEmitter = require('events'); | ||
// const EventEmitter = require('events'); | ||
|
||
const myEmitter = new EventEmitter(); | ||
// const myEmitter = new EventEmitter(); | ||
|
||
myEmitter.once('newListener', (event, listener)=>{ | ||
console.log(event, listener); | ||
if(event == 'event') { | ||
myEmitter.on('event', ()=>{ | ||
console.log("B"); | ||
}); | ||
} | ||
}); | ||
// myEmitter.once('newListener', (event, listener)=>{ | ||
// console.log(event, listener); | ||
// if(event == 'event') { | ||
// myEmitter.on('event', ()=>{ | ||
// console.log("B"); | ||
// }); | ||
// } | ||
// }); | ||
|
||
myEmitter.on('event', ()=>{ | ||
console.log('A'); | ||
}); | ||
// myEmitter.on('event', ()=>{ | ||
// console.log('A'); | ||
// }); | ||
|
||
myEmitter.emit('event'); | ||
// myEmitter.emit('event'); | ||
|
||
console.log(EventEmitter.listenerCount(myEmitter, 'event')); | ||
myEmitter.setMaxListeners(12); | ||
console.log(myEmitter.getMaxListeners()); | ||
console.log(myEmitter.eventNames()); | ||
// console.log(EventEmitter.listenerCount(myEmitter, 'event')); | ||
// myEmitter.setMaxListeners(12); | ||
// console.log(myEmitter.getMaxListeners()); | ||
// console.log(myEmitter.eventNames()); | ||
|
||
var miniToastr = require('mini-toastr'); | ||
|
||
const toastTypes = { | ||
success: 'success', | ||
error: 'error', | ||
info: 'info', | ||
warn: 'warn' | ||
}; | ||
|
||
miniToastr.init({ types: toastTypes }); | ||
|
||
miniToastr.success({ message: 11 }) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ ul li { | |
list-style: none; | ||
text-align: left; | ||
} | ||
.mini-toastr { | ||
right: 50% !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,7 @@ body{ | |
ul li{ | ||
list-style: none; | ||
text-align: left; | ||
} | ||
.mini-toastr{ | ||
right: 50%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import Vue from 'vue'; | ||
import VueNotifications from 'vue-notifications'; | ||
import miniToastr from 'mini-toastr'; | ||
import warnIcon from '~/assets/apple_hover.png'; | ||
|
||
const toastTypes = { | ||
success: 'success', | ||
error: 'error', | ||
info: 'info', | ||
warn: 'warn' | ||
}; | ||
|
||
// This step requires only for mini-toastr, just an initialization | ||
miniToastr.init({ | ||
types: toastTypes, | ||
// style: { | ||
// 'mini-toastr':{ | ||
// left:'50%' | ||
// }, | ||
// 'mini-toastr__notification': { | ||
// 'mini-toastr-notification__message': { | ||
// 'border-radius': '5px', | ||
// 'color': 'red' | ||
// } | ||
// } | ||
// } | ||
}); | ||
miniToastr.setIcon('error', 'i', {'class': 'fa fa-warning'}) | ||
miniToastr.setIcon('info', 'i', {'class': 'fa fa-info-circle'}) | ||
miniToastr.setIcon('success', 'i', {'class': 'fa fa-check-circle-o'}) | ||
miniToastr.setIcon('warn', 'img', {src: warnIcon, style: 'vertical-align: bottom;'}) | ||
|
||
function toast({ title, message, type, timeout, cb }) { | ||
return miniToastr[type](message, title, timeout, cb); | ||
} | ||
|
||
const options = { | ||
success: toast, | ||
error: toast, | ||
info: toast, | ||
warn: toast | ||
}; | ||
|
||
Vue.use(VueNotifications, options); | ||
|
||
|