Browse Source

Updated the typings

main
Cédric Belin 1 week ago
parent
commit
c3920c1b83
3 changed files with 3 additions and 3 deletions
  1. +1
    -1
      doc/usage/api.md
  2. +1
    -1
      lib/index.d.ts
  3. +1
    -1
      src/webstorage/WebStorage.hx

+ 1
- 1
doc/usage/api.md View File

@@ -299,7 +299,7 @@ Otherwise calls `ifAbsent` to get a new value, associates the key to that value,
console.log(value); // "bar"
}

## **putObjectIfAbsent**(key: String, ifAbsent: () -> Any): Dynamic
## **putObjectIfAbsent**(key: String, ifAbsent: () -> Dynamic): Dynamic
Looks up the value of the specified key, or add a new value if it isn't there.

Returns the deserialized value associated to the key, if there is one.


+ 1
- 1
lib/index.d.ts View File

@@ -9,7 +9,7 @@ export declare abstract class WebStorage extends EventTarget implements Iterable
get(key: string, defaultValue?: string): string|undefined;
getObject(key: string, defaultValue?: unknown): any;
putIfAbsent(key: string, ifAbsent: () => string): string;
putObjectIfAbsent(key: string, ifAbsent: () => unknown): any;
putObjectIfAbsent(key: string, ifAbsent: () => any): any;
remove(key: string): string|undefined;
set(key: string, value: string): this;
setObject(key: string, value: unknown): this;


+ 1
- 1
src/webstorage/WebStorage.hx View File

@@ -96,7 +96,7 @@ import js.lib.Symbol;
Returns the deserialized value associated to `key`, if there is one.
Otherwise calls `ifAbsent` to get a new value, serializes and associates `key` to that value, and then returns the new value.
**/
public function putObjectIfAbsent(key: String, ifAbsent: () -> Any): Dynamic {
public function putObjectIfAbsent(key: String, ifAbsent: () -> Dynamic): Dynamic {
if (!exists(key)) setObject(key, ifAbsent());
return getObject(key);
}


Loading…
Cancel
Save