-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
103 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { webApp } from '../../webApp' | ||
|
||
export function getItem(key: string) { | ||
return new Promise<string>((resolve, reject) => { | ||
webApp.CloudStorage.getItem(key, function (error: any, value: string) { | ||
if (error) { | ||
reject(error) | ||
} | ||
|
||
resolve(value) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { webApp } from '../../webApp' | ||
|
||
export function getItems<T extends string[] = string[]>(keys: T) { | ||
return new Promise<T>((resolve, reject) => { | ||
webApp.CloudStorage.getItems(keys, function (error: any, value: T) { | ||
if (error) { | ||
reject(error) | ||
} | ||
|
||
resolve(value) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { webApp } from '../../webApp' | ||
|
||
export function getKeys() { | ||
return new Promise<string[]>((resolve, reject) => { | ||
webApp.CloudStorage.getKeys(function (error: any, value: string[]) { | ||
if (error) { | ||
reject(error) | ||
} | ||
|
||
resolve(value) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export { getItem } from './getItem' | ||
export { getItems } from './getItems' | ||
export { getKeys } from './getKeys' | ||
export { removeItem } from './removeItem' | ||
export { removeItems } from './removeItems' | ||
export { setItem } from './setItem' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { webApp } from '../../webApp' | ||
|
||
export function removeItem(key: string) { | ||
return new Promise<void>((resolve, reject) => { | ||
webApp.CloudStorage.removeItem(key, function (error: any) { | ||
if (error) { | ||
reject(error) | ||
} | ||
|
||
resolve() | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { webApp } from '../../webApp' | ||
|
||
export function removeItems(keys: string[]) { | ||
return new Promise<void>((resolve, reject) => { | ||
webApp.CloudStorage.removeItem(keys, function (error: any) { | ||
if (error) { | ||
reject(error) | ||
} | ||
|
||
resolve() | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { webApp } from '../../webApp' | ||
|
||
export function setItem(key: string, value: string) { | ||
return new Promise<void>((resolve, reject) => { | ||
webApp.CloudStorage.setItem(key, value, function (error: any) { | ||
if (error) { | ||
reject(error) | ||
} | ||
|
||
resolve() | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters