Module: LocalStorage
- Defined in:
- lib/volt/utils/local_storage.rb,
lib/volt/utils/local_storage.rb
Constant Summary collapse
- @@store =
{}
Class Method Summary collapse
Class Method Details
.[](key) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/volt/utils/local_storage.rb', line 3 def self.[](key) %x{ var val = localStorage.getItem(key); return val === null ? nil : val; } end |
.[]=(key, value) ⇒ Object
10 11 12 |
# File 'lib/volt/utils/local_storage.rb', line 10 def self.[]=(key, value) `localStorage.setItem(key, value)` end |
.clear ⇒ Object
14 15 16 17 |
# File 'lib/volt/utils/local_storage.rb', line 14 def self.clear `localStorage.clear()` self end |
.delete(key) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/volt/utils/local_storage.rb', line 19 def self.delete(key) %x{ var val = localStorage.getItem(key); localStorage.removeItem(key); return val === null ? nil : val; } end |