diff options
author | Antonis Geralis <43617260+planetis-m@users.noreply.github.com> | 2021-01-29 21:37:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-29 20:37:31 +0100 |
commit | 2c70734913c935d3f2f4df332f72bd9aa714661c (patch) | |
tree | 248444b878bf1f1e5f818d7e15dc9d9ffbffaef6 /lib/js | |
parent | 1097cc41737d5c5a3d244cdb7c4cb01c3b8c3c87 (diff) | |
download | Nim-2c70734913c935d3f2f4df332f72bd9aa714661c.tar.gz |
Add StorageEvent and correct Storage object (#16865)
There is no `LocalStorage` type, it's `Storage`
Diffstat (limited to 'lib/js')
-rw-r--r-- | lib/js/dom.nim | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/lib/js/dom.nim b/lib/js/dom.nim index 59d1381c7..58a33c926 100644 --- a/lib/js/dom.nim +++ b/lib/js/dom.nim @@ -37,6 +37,7 @@ type onmouseup*: proc (event: Event) {.closure.} onreset*: proc (event: Event) {.closure.} onselect*: proc (event: Event) {.closure.} + onstorage*: proc (event: Event) {.closure.} onsubmit*: proc (event: Event) {.closure.} onunload*: proc (event: Event) {.closure.} onloadstart*: proc (event: Event) {.closure.} @@ -72,6 +73,7 @@ type Resize = "resize", Scroll = "scroll", Select = "select", + Storage = "storage", Unload = "unload", Wheel = "wheel" @@ -125,7 +127,7 @@ type rangeCount*: int `type`*: cstring - LocalStorage* {.importc.} = ref object + Storage* {.importc.} = ref object Window* = ref WindowObj WindowObj {.importc.} = object of EventTargetObj @@ -153,7 +155,8 @@ type screen*: Screen performance*: Performance onpopstate*: proc (event: Event) - localStorage*: LocalStorage + localStorage*: Storage + sessionStorage*: Storage parent*: Window Frame* = ref FrameObj @@ -1210,6 +1213,13 @@ type ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/ClipboardEvent>`_ clipboardData*: DataTransfer + StorageEvent* = ref StorageEventObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/StorageEvent>`_ + StorageEventObj {.importc.} = object of Event + key*: cstring + newValue*, oldValue*: cstring + storageArea*: Storage + url*: cstring + TouchList* {.importc.} = ref object of RootObj length*: int @@ -1654,12 +1664,12 @@ proc getRangeAt*(s: Selection, index: int): Range converter toString*(s: Selection): cstring proc `$`*(s: Selection): string = $(s.toString()) -# LocalStorage "methods" -proc getItem*(ls: LocalStorage, key: cstring): cstring -proc setItem*(ls: LocalStorage, key, value: cstring) -proc hasItem*(ls: LocalStorage, key: cstring): bool -proc clear*(ls: LocalStorage) -proc removeItem*(ls: LocalStorage, key: cstring) +# Storage "methods" +proc getItem*(s: Storage, key: cstring): cstring +proc setItem*(s: Storage, key, value: cstring) +proc hasItem*(s: Storage, key: cstring): bool +proc clear*(s: Storage) +proc removeItem*(s: Storage, key: cstring) {.pop.} |