Class: LocalStorage

Inherits:
Object
  • Object
show all
Defined in:
src/ruby/platform_specific/web.rb

Overview

A class for interacting with the browser’s LocalStorage

Class Method Summary collapse

Class Method Details

.get_item(key) ⇒ String

Returns the value stored in localStorage in the browser, if it doesn’t exist it will just return an empty string

Parameters:

  • key (String)

Returns:

  • (String)

Raises:

  • (PlatformSpecificMethodCalledOnWrongPlatformError)

    If run on non-web platforms



18
19
20
# File 'src/ruby/platform_specific/web.rb', line 18

def self.get_item(key)
  raise PlatformSpecificMethodCalledOnWrongPlatformError, 'LocalStorage.get_item is only available for Web exports'
end

.set_item(key, value) ⇒ nil

Sets the value in localStorage in the browser

Parameters:

  • key (String)
  • value (String)

Returns:

  • (nil)

Raises:

  • (PlatformSpecificMethodCalledOnWrongPlatformError)

    If run on non-web platforms



27
28
29
# File 'src/ruby/platform_specific/web.rb', line 27

def self.set_item(key, value)
  raise PlatformSpecificMethodCalledOnWrongPlatformError, 'LocalStorage.set_item is only available for Web exports'
end