[ADF-4152] Updated folder structure of core docs (#4415)

* [ADF-4152] Moved core library docs into subfolders

* [ADF-4152] Moved core library docs into subfolders

* [ADF-4152] Manual fixes to core doc file links

* [ADF-4152] Further automatic + manual link tidying
This commit is contained in:
Andy Stark
2019-03-12 14:20:20 +00:00
committed by Eugenio Romano
parent 285e56e9fb
commit 5fc05da7aa
121 changed files with 1112 additions and 1329 deletions

View File

@@ -0,0 +1,50 @@
---
Title: Storage service
Added: v2.0.0
Status: Active
Last reviewed: 2018-11-14
---
# [Storage service](../../../lib/core/services/storage.service.ts "Defined in storage.service.ts")
Stores items in the form of key-value pairs.
## Class members
### Methods
- **clear**()<br/>
Removes all currently stored items.
- **getItem**(key: `string`): `string|null`<br/>
Gets an item.
- _key:_ `string` - Key to identify the item
- **Returns** `string|null` - The item (if any) retrieved by the key
- **hasItem**(key: `string`): `boolean`<br/>
Is any item currently stored under `key`?
- _key:_ `string` - Key identifying item to check
- **Returns** `boolean` - True if key retrieves an item, false otherwise
- **removeItem**(key: `string`)<br/>
Removes a single item.
- _key:_ `string` - Key to identify the item
- **setItem**(key: `string`, data: `string`)<br/>
Stores an item
- _key:_ `string` - Key to identify the item
- _data:_ `string` - Data to store
## Details
The service will check to see if
[web storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage/LocalStorage)
is available on the browser. If it is available then the service will use it to
store the key-value items persistently. Web storage can be used in a similar way to
[cookies](cookie.service.md) but with a much higher size limit (several MB for
web storage compared to a few KB for cookies). However, cookies are
more widely supported by browsers and can be set to expire after a certain date.
If local storage is not available then non-persistent memory storage within the app is
used instead.
## See also
- [Cookie service](cookie.service.md)
- [Content service](content.service.md)