source: branches/testa/js/storage.js @ 23

Last change on this file since 23 was 23, checked in by anonymous, 6 years ago

init

File size: 641 bytes
Line 
1let _globalStorage = {}
2
3function save_info_to_local_storage(info){
4    _globalStorage["info"] = info
5    save_to_local_storage(JSON.stringify(info), "info")
6}
7
8function save_filelist_to_local_storage(text , num){
9    let num_s = num + ''
10    save_to_local_storage(text, key)
11}
12
13function save_to_local_storage(str, key) {
14    _globalStorage[key] = str
15    localStorage.setItem(key , str)
16}
17
18function get_filelist(num) {
19    let num_s = num + ''
20    if( _globalStorage[num_s] === undefined ){
21        oldData = localStorage.getItem(num_s)
22        if( oldData ){
23            _globalStorage[num_s] = JSON.parse(oldData)
24        }
25    }
26    return _globalStorage[num_s]
27}
28
Note: See TracBrowser for help on using the repository browser.