Sha256: b74475b79fa6a60f652148a8a32d06cb8a3ca2417309d10d5ad82f0546cc601c
Contents?: true
Size: 918 Bytes
Versions: 22
Compression:
Stored size: 918 Bytes
Contents
class SessionStore extend Isomorfeus::BrowserStoreApi class << self def method_missing(key, *args, &block) if Isomorfeus.on_browser? if `args.length > 0` key = `key.endsWith('=')` ? key.chop : key value = args[0] `Opal.global.sessionStorage.setItem(key, value)` notify_subscribers value else # check store for value value = `Opal.global.sessionStorage.getItem(key)` return value if value end end # otherwise return nil return nil end alias [] method_missing alias []= method_missing alias get method_missing alias set method_missing def delete(key) `Opal.global.sessionStorage.removeItem(key)` notify_subscribers nil end def clear `Opal.global.sessionStorage.clear()` notify_subscribers nil end end end
Version data entries
22 entries across 22 versions & 1 rubygems