new ClockLocalStorage(clock)
Handles interaction with window.localStorage for saving/loading timezones from localStorage.
Parameters:
Name | Type | Description |
---|---|---|
clock |
Clock | World Clock API |
- Source:
Methods
(private) _getItem(key) → {Any}
Wrapper for window.localStorage.getItem method.
Parameters:
Name | Type | Description |
---|---|---|
key |
String | String object key, which allow to access saved data. |
- Source:
Returns:
Any saved value.
- Type
- Any
(private) _setItem(key, value)
Wrapper for window.localStorage.setItem method.
Parameters:
Name | Type | Description |
---|---|---|
key |
String | String object key, which will allow to access saved data later. |
value |
Any | Any value to be saven in localStorage. |
- Source:
getTimezone() → {null|TimezoneObject}
Reconstruct currently saved timezone from the LocalStorage.
- Source:
Returns:
null - no saved timezone, reconstructed TimezoneObject - otherwise.
- Type
- null | TimezoneObject
saveTimezone(timezoneObject)
Save selected timezone to the local storage for reconstruction after page reload.
Parameters:
Name | Type | Description |
---|---|---|
timezoneObject |
TimezoneObject |
- Source:
Throws:
-
if trying to save not a TimezoneObject.
- Type
- WorldClockError