Sha256: 44ac1cdbba4b61ec0695fc134b8cc46491b40d4c7c0136a7622cfeefde780a39

Contents?: true

Size: 440 Bytes

Versions: 4

Compression:

Stored size: 440 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

4 entries across 4 versions & 1 rubygems

Version Path
opal-jquery-0.0.7 lib/assets/javascripts/opal/jquery/local_storage.rb
opal-jquery-0.0.6 lib/assets/javascripts/opal/jquery/local_storage.rb
opal-jquery-0.0.5 lib/assets/javascripts/opal/jquery/local_storage.rb
opal-jquery-0.0.4 lib/assets/javascripts/opal/jquery/local_storage.rb