forked from fable-compiler/fable-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBrowser.WebStorage.fs
32 lines (26 loc) · 895 Bytes
/
Browser.WebStorage.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
namespace Browser.Types
open System
open Fable.Core
type [<AllowNullLiteral>] Storage =
abstract length: int
[<Emit("$0[$1]{{=$2}}")>] abstract Item: key: string -> string with get, set
[<Emit("$0[$1]{{=$2}}")>] abstract Item: index: int -> string with get, set
abstract clear: unit -> unit
abstract getItem: key: string -> string
abstract key: index: float -> string
abstract removeItem: key: string -> unit
abstract setItem: key: string * data: string -> unit
type [<AllowNullLiteral>] StorageEvent =
inherit Event
abstract url: string
abstract key: string
abstract oldValue: string
abstract newValue: string
abstract storageArea: Storage
namespace Browser
open Fable.Core
open Browser.Types
[<AutoOpen>]
module WebStorage =
let [<Global>] localStorage: Storage = jsNative
let [<Global>] sessionStorage: Storage = jsNative