File tree 1 file changed +38
-0
lines changed
apps/docs/packages/telegram-apps-sdk/3-x/utils
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1
1
# Uncategorized
2
2
3
+ ## ` copyTextToClipboard `
4
+
5
+ Copies specified text to the clipboard using all known methods.
6
+
7
+ ``` ts
8
+ import { copyTextToClipboard } from ' @telegram-apps/sdk' ;
9
+
10
+ await copyTextToClipboard (' My text goes here' );
11
+ ```
12
+
13
+ ## ` downloadFile `
14
+
15
+ To request file download, use the ` downloadFile ` function. It accepts a file URL and its proposed saved name.
16
+
17
+ ::: code-group
18
+
19
+ ``` ts [Using isAvailable]
20
+ import { downloadFile } from ' @telegram-apps/sdk' ;
21
+
22
+ if (downloadFile .isAvailable ()) {
23
+ await downloadFile (
24
+ ' https://telegram.org/js/telegram-web-app.js' ,
25
+ ' telegram-sdk.js' ,
26
+ );
27
+ }
28
+ ```
29
+
30
+ ``` ts [Using ifAvailable]
31
+ import { downloadFile } from ' @telegram-apps/sdk' ;
32
+
33
+ await downloadFile .ifAvailable (
34
+ ' https://telegram.org/js/telegram-web-app.js' ,
35
+ ' telegram-sdk.js' ,
36
+ );
37
+ ```
38
+
39
+ :::
40
+
3
41
## ` getCurrentTime `
4
42
5
43
To retrieve the current Telegram server time, use the ` getCurrentTime ` function. It returns
You can’t perform that action at this time.
0 commit comments