aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/root-helpers/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/root-helpers/utils.ts')
-rw-r--r--client/src/root-helpers/utils.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/client/src/root-helpers/utils.ts b/client/src/root-helpers/utils.ts
index de4e08bf5..e32187ddb 100644
--- a/client/src/root-helpers/utils.ts
+++ b/client/src/root-helpers/utils.ts
@@ -9,6 +9,18 @@ function objectToUrlEncoded (obj: any) {
9 return str.join('&') 9 return str.join('&')
10} 10}
11 11
12function copyToClipboard (text: string) {
13 const el = document.createElement('textarea')
14 el.value = text
15 el.setAttribute('readonly', '')
16 el.style.position = 'absolute'
17 el.style.left = '-9999px'
18 document.body.appendChild(el)
19 el.select()
20 document.execCommand('copy')
21 document.body.removeChild(el)
22}
23
12// Thanks: https://github.com/uupaa/dynamic-import-polyfill 24// Thanks: https://github.com/uupaa/dynamic-import-polyfill
13function importModule (path: string) { 25function importModule (path: string) {
14 return new Promise((resolve, reject) => { 26 return new Promise((resolve, reject) => {
@@ -51,6 +63,7 @@ function wait (ms: number) {
51} 63}
52 64
53export { 65export {
66 copyToClipboard,
54 importModule, 67 importModule,
55 objectToUrlEncoded, 68 objectToUrlEncoded,
56 wait 69 wait