forked from Mashiane/BANanoVuetifyAD3
-
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.
- Loading branch information
Showing
49 changed files
with
12,268 additions
and
213 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,110 @@ | ||
var STORAGE = null; | ||
var VueSession = { | ||
key: 'vue-session-key', | ||
flash_key: 'vue-session-flash-key', | ||
setAll: function(all){ | ||
STORAGE.setItem(VueSession.key,JSON.stringify(all)); | ||
} | ||
} | ||
|
||
VueSession.install = function(Vue, options) { | ||
if(options && 'persist' in options && options.persist) STORAGE = window.localStorage; | ||
else STORAGE = window.sessionStorage; | ||
Vue.prototype.$session = { | ||
flash: { | ||
parent: function(){ | ||
return Vue.prototype.$session; | ||
}, | ||
get: function(key){ | ||
var all = this.parent().getAll(); | ||
var all_flash = all[VueSession.flash_key] || {}; | ||
|
||
var flash_value = all_flash[key]; | ||
|
||
this.remove(key); | ||
|
||
return flash_value; | ||
}, | ||
set: function(key, value){ | ||
var all = this.parent().getAll(); | ||
var all_flash = all[VueSession.flash_key] || {}; | ||
|
||
all_flash[key] = value; | ||
all[VueSession.flash_key] = all_flash; | ||
|
||
VueSession.setAll(all); | ||
}, | ||
remove: function(key){ | ||
var all = this.parent().getAll(); | ||
var all_flash = all[VueSession.flash_key] || {}; | ||
|
||
delete all_flash[key]; | ||
|
||
all[VueSession.flash_key] = all_flash; | ||
VueSession.setAll(all); | ||
} | ||
}, | ||
getAll: function(){ | ||
var all = JSON.parse(STORAGE.getItem(VueSession.key)); | ||
return all || {}; | ||
}, | ||
set: function(key,value){ | ||
if(key == 'session-id') return false; | ||
var all = this.getAll(); | ||
|
||
if(!('session-id' in all)){ | ||
this.start(); | ||
all = this.getAll(); | ||
} | ||
|
||
all[key] = value; | ||
|
||
VueSession.setAll(all); | ||
}, | ||
get: function(key){ | ||
var all = this.getAll(); | ||
return all[key]; | ||
}, | ||
start: function(){ | ||
var all = this.getAll(); | ||
all['session-id'] = 'sess:'+Date.now(); | ||
|
||
VueSession.setAll(all); | ||
}, | ||
renew: function(sessionId){ | ||
var all = this.getAll(); | ||
all['session-id'] = 'sess:' + sessionId; | ||
VueSession.setAll(all); | ||
}, | ||
exists: function(){ | ||
var all = this.getAll(); | ||
return 'session-id' in all; | ||
}, | ||
has: function(key){ | ||
var all = this.getAll(); | ||
return key in all; | ||
}, | ||
remove: function(key){ | ||
var all = this.getAll(); | ||
delete all[key]; | ||
|
||
VueSession.setAll(all); | ||
}, | ||
clear: function(){ | ||
var all = this.getAll(); | ||
|
||
VueSession.setAll({'session-id': all['session-id']}); | ||
}, | ||
destroy: function(){ | ||
VueSession.setAll({}); | ||
}, | ||
id: function(){ | ||
return this.get('session-id'); | ||
} | ||
} | ||
}; | ||
|
||
if(typeof window !== 'undefined' && window.Vue){ | ||
window.VueSession = VueSession; | ||
window.Vue.use(VueSession); | ||
} |
Oops, something went wrong.