Sha256: 822d2b9c220f94a60c333f110d37aa9fe2b408c6576b6a98a71d04489a2ffa06

Contents?: true

Size: 439 Bytes

Versions: 3

Compression:

Stored size: 439 Bytes

Contents

module LocalStorage
  def self.[](key)
    %x{
      var val = localStorage.getItem(key);
      return val === null ? nil : val;
    }
  end

  def self.[]=(key, value)
    `localStorage.setItem(key, value)`
  end

  def self.clear
    `localStorage.clear()`
    self
  end

  def self.delete(key)
    %x{
      var val = localStorage.getItem(key);
      localStorage.removeItem(key);
      return val === null ? nil : val;
    }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opal-jquery-0.0.3 lib/opal-jquery/local_storage.rb
opal-jquery-0.0.2 lib/opal-jquery/local_storage.rb
opal-jquery-0.0.1 lib/opal-jquery/local_storage.rb