Created
March 21, 2016 22:51
-
-
Save xtrasmal/98b9c48e3b4b806a2269 to your computer and use it in GitHub Desktop.
Vue Flasher with alertify.js
This file contains hidden or 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
import alertify from 'alertify.js'; | |
const Flasher = { | |
success(thing, action) { | |
alertify.logPosition("top right"); | |
alertify.success(`Het ${thing} is ${action}.`); | |
}, | |
error(thing, action) { | |
alertify.logPosition("top right"); | |
alertify.error(`Het ${thing} kon niet worden ${action}.`); | |
}, | |
delete(origin, event, uuid) { | |
const caller = origin; | |
const evt = event; | |
const id = uuid; | |
alertify | |
.okBtn("Ja ik weet het zeker") | |
.cancelBtn("Nee") | |
.confirm("Weet je het zeker?", () => { | |
caller.$emit(evt, id); | |
}, () => { | |
alertify | |
.logPosition("top right") | |
.error("Het item is niet verwijderd."); | |
}); | |
} | |
}; | |
export default Flasher; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment