@popclip/types 1.4666.0 → 1.4670.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extra/define.d.ts +3 -5
- package/package.json +1 -1
- package/popclip.d.ts +111 -69
package/extra/define.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Export an object for use by another file.
|
|
3
3
|
*
|
|
4
|
-
* #### Notes
|
|
5
|
-
*
|
|
6
4
|
* The _define_ function family exports an arbitrary object, which other files can import using {@link require}.
|
|
7
5
|
*
|
|
8
6
|
* It should be called only once in any file; if it is called more than once, only the
|
|
@@ -17,7 +15,7 @@ declare function define(factory: () => object): void;
|
|
|
17
15
|
declare function define(dependencies: string[], factory: () => object): void;
|
|
18
16
|
declare function define(id: string, factory: () => object): void;
|
|
19
17
|
declare function define(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
id: string,
|
|
19
|
+
dependencies: string[],
|
|
20
|
+
factory: () => object,
|
|
23
21
|
): void;
|
package/package.json
CHANGED
package/popclip.d.ts
CHANGED
|
@@ -49,14 +49,12 @@ interface StringTable {
|
|
|
49
49
|
/**
|
|
50
50
|
* A type to represent a localizable string.
|
|
51
51
|
*
|
|
52
|
-
* #### Notes
|
|
53
|
-
*
|
|
54
52
|
* The value may be either a string or an object.
|
|
55
53
|
* If you supply a string, that string is used.
|
|
56
54
|
* If you supply a {@link StringTable} object, PopClip will
|
|
57
55
|
* display the string for the user's preferred language if possible, with fallback to the `en` string.
|
|
58
56
|
*
|
|
59
|
-
*
|
|
57
|
+
* @example
|
|
60
58
|
* ```js
|
|
61
59
|
* option.label = "Color" // just use this string
|
|
62
60
|
* option.label = { en: "Color", "en-GB": "Colour", fr: "Couleur", "zh-Hans": "颜色" }
|
|
@@ -83,7 +81,7 @@ interface Modifiers {
|
|
|
83
81
|
/**
|
|
84
82
|
* A requirement is specified in the {@link Action.requirements} array as a string.
|
|
85
83
|
*
|
|
86
|
-
*
|
|
84
|
+
* @example
|
|
87
85
|
* ```js
|
|
88
86
|
* ["paste", "!urls", "option-goFishing=1"]
|
|
89
87
|
* ```
|
|
@@ -293,8 +291,6 @@ interface ActionProperties extends IconProperties {
|
|
|
293
291
|
* * If no array is specified here, the action takes the value of {@link Extension.requirements}.
|
|
294
292
|
* * If no array is specified there either, the action takes the default value `["text"]`.
|
|
295
293
|
*
|
|
296
|
-
* #### Notes
|
|
297
|
-
*
|
|
298
294
|
* When multiple conditions are specified, all of them must be satisfied.
|
|
299
295
|
*
|
|
300
296
|
* An empty array (`[]`) indicates no requirements at all, meaning the action will always appear.
|
|
@@ -325,8 +321,6 @@ interface ActionProperties extends IconProperties {
|
|
|
325
321
|
* * If no regex is specified here, the action takes the value of {@link Extension.regex}.
|
|
326
322
|
* * If no regex is specified there either, the action will match any input.
|
|
327
323
|
*
|
|
328
|
-
* #### Notes
|
|
329
|
-
*
|
|
330
324
|
* You may express the value either as a
|
|
331
325
|
* [JavaScript regular expression literal](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)
|
|
332
326
|
* (or otherwise constructed `RegExp` object), or as a string.
|
|
@@ -343,7 +337,7 @@ interface ActionProperties extends IconProperties {
|
|
|
343
337
|
*
|
|
344
338
|
* This property has no effect on dynamically generated actions.
|
|
345
339
|
*
|
|
346
|
-
*
|
|
340
|
+
* @example
|
|
347
341
|
* ```js
|
|
348
342
|
* regex = /abc/i // Example regex 'abc' with 'i' (case insensitive) flag
|
|
349
343
|
* // Matches abc, ABC, Abc, etc.
|
|
@@ -424,7 +418,7 @@ type ActionFunction<CustomOptions = Options> = (
|
|
|
424
418
|
* If `code` is omitted, the action displays a disabled title/icon only.
|
|
425
419
|
*/
|
|
426
420
|
interface Action<CustomOptions = Options> extends ActionProperties {
|
|
427
|
-
code?: ActionFunction<CustomOptions>;
|
|
421
|
+
readonly code?: ActionFunction<CustomOptions>;
|
|
428
422
|
}
|
|
429
423
|
|
|
430
424
|
// included for JSON Schema
|
|
@@ -667,7 +661,7 @@ interface Input {
|
|
|
667
661
|
*
|
|
668
662
|
* If the regex was specified as an ICU regex in the static config, the value is the array of capture components.
|
|
669
663
|
*
|
|
670
|
-
*
|
|
664
|
+
* @example
|
|
671
665
|
* ```js
|
|
672
666
|
* // text: "apple", regex: /.(.)/
|
|
673
667
|
* selection.regexResult[0] // "ap" (full match)
|
|
@@ -802,7 +796,6 @@ interface PopClip {
|
|
|
802
796
|
/**
|
|
803
797
|
* The state of the modifier keys when the action was invoked in PopClip.
|
|
804
798
|
*
|
|
805
|
-
* #### Notes
|
|
806
799
|
* During the execution of the population function, all the modifiers will read as false.
|
|
807
800
|
*/
|
|
808
801
|
readonly modifiers: Modifiers;
|
|
@@ -829,7 +822,7 @@ interface PopClip {
|
|
|
829
822
|
*
|
|
830
823
|
* If the target app's Paste command is not available, it behaves as {@link copyText} instead.
|
|
831
824
|
*
|
|
832
|
-
*
|
|
825
|
+
* @example
|
|
833
826
|
*
|
|
834
827
|
* ```js
|
|
835
828
|
* // place "Hello" on the clipboard and invoke Paste
|
|
@@ -840,30 +833,30 @@ interface PopClip {
|
|
|
840
833
|
* @param text The plain text string to paste
|
|
841
834
|
* @param options
|
|
842
835
|
*/
|
|
843
|
-
pasteText
|
|
836
|
+
pasteText(text: string, options?: PasteOptions): void;
|
|
844
837
|
|
|
845
838
|
/**
|
|
846
|
-
* Paste
|
|
839
|
+
* Paste mixed pasteboard content.
|
|
847
840
|
*/
|
|
848
|
-
pasteContent
|
|
841
|
+
pasteContent(content: PasteboardContent, options?: PasteOptions): void;
|
|
849
842
|
|
|
850
843
|
/**
|
|
851
|
-
*
|
|
844
|
+
* Place the given string on the pasteboard, optionally showing "Copied" notification to the user.
|
|
852
845
|
* @param text The plain text string to copy
|
|
853
846
|
*/
|
|
854
|
-
copyText
|
|
847
|
+
copyText(text: string, options?: CopyOptions): void;
|
|
855
848
|
|
|
856
849
|
/**
|
|
857
|
-
*
|
|
850
|
+
* Place mixed content on the pasteboard, optionally showing "Copied" notification to the user.
|
|
858
851
|
*/
|
|
859
|
-
copyContent
|
|
852
|
+
copyContent(content: PasteboardContent, options?: CopyOptions): void;
|
|
860
853
|
|
|
861
854
|
/**
|
|
862
855
|
* Invokes a command in the target app.
|
|
863
856
|
* @param command Either `cut`, `copy` or `paste`.
|
|
864
857
|
* @param options Options for the command.
|
|
865
858
|
*/
|
|
866
|
-
performCommand
|
|
859
|
+
performCommand(
|
|
867
860
|
command: "cut" | "copy" | "paste",
|
|
868
861
|
options?: {
|
|
869
862
|
/** Transformation to apply to the pasteboard contents. (Default: `none`)
|
|
@@ -872,14 +865,14 @@ interface PopClip {
|
|
|
872
865
|
*/
|
|
873
866
|
transform?: "none" | "plain";
|
|
874
867
|
},
|
|
875
|
-
)
|
|
868
|
+
): void;
|
|
876
869
|
|
|
877
870
|
/**
|
|
878
871
|
* Display text to the user.
|
|
879
872
|
* @param text The text to display.
|
|
880
873
|
* @param options Options.
|
|
881
874
|
*/
|
|
882
|
-
showText
|
|
875
|
+
showText(
|
|
883
876
|
text: string,
|
|
884
877
|
options?: {
|
|
885
878
|
/**
|
|
@@ -894,35 +887,34 @@ interface PopClip {
|
|
|
894
887
|
*/
|
|
895
888
|
preview?: boolean;
|
|
896
889
|
},
|
|
897
|
-
)
|
|
890
|
+
): void;
|
|
898
891
|
|
|
899
892
|
/**
|
|
900
893
|
* PopClip will show a checkmark symbol to indicate success.
|
|
901
894
|
*/
|
|
902
|
-
showSuccess
|
|
895
|
+
showSuccess(): void;
|
|
903
896
|
|
|
904
897
|
/**
|
|
905
898
|
* PopClip will show an "X" symbol to indicate failure.
|
|
906
899
|
*/
|
|
907
|
-
showFailure
|
|
900
|
+
showFailure(): void;
|
|
908
901
|
|
|
909
902
|
/**
|
|
910
903
|
* PopClip will open the settings UI for this extension.
|
|
911
904
|
*
|
|
912
|
-
* #### Notes
|
|
913
905
|
* If the extension has no settings, this method does nothing.
|
|
914
906
|
*/
|
|
915
|
-
showSettings
|
|
907
|
+
showSettings(): void;
|
|
916
908
|
|
|
917
909
|
/**
|
|
918
910
|
* Trigger PopClip to appear again with the current selection.
|
|
919
911
|
*/
|
|
920
|
-
appear
|
|
912
|
+
appear(): void;
|
|
921
913
|
|
|
922
914
|
/**
|
|
923
915
|
* Simulate a key press by the user.
|
|
924
916
|
*
|
|
925
|
-
*
|
|
917
|
+
* @examples
|
|
926
918
|
*
|
|
927
919
|
* ```js
|
|
928
920
|
* // press the key combo ⌘B
|
|
@@ -937,8 +929,6 @@ interface PopClip {
|
|
|
937
929
|
* popclip.pressKey(0x79, util.constant.MODIFIER_OPTION); // equivalent
|
|
938
930
|
* ```
|
|
939
931
|
*
|
|
940
|
-
* #### Notes
|
|
941
|
-
*
|
|
942
932
|
* Some key code and modifier constants are available in {@link Util.constant | util.constant}.
|
|
943
933
|
*
|
|
944
934
|
* @param key The key to press. When this parameter is a string, PopClip will interpret it as in
|
|
@@ -947,39 +937,40 @@ interface PopClip {
|
|
|
947
937
|
*
|
|
948
938
|
* @param modifiers An optional bit mask specifiying additional modifier keys, if any.
|
|
949
939
|
*/
|
|
950
|
-
pressKey
|
|
940
|
+
pressKey(key: string | number, modifiers?: number): void;
|
|
951
941
|
|
|
952
942
|
/**
|
|
953
|
-
* Open a URL in
|
|
954
|
-
*
|
|
955
|
-
* #### Choice of application
|
|
943
|
+
* Open a URL in a browser or other application.
|
|
956
944
|
*
|
|
957
945
|
* If a target application bundle identifier is specified via the `app` option, PopClip will ask that app to open the URL.
|
|
958
946
|
*
|
|
959
947
|
* If no target app is specified:
|
|
960
948
|
*
|
|
961
|
-
* - If the URL
|
|
962
|
-
* - Otherwise, PopClip asks macOS to open the URL in the default handler for
|
|
963
|
-
*
|
|
964
|
-
* #### URL encoding
|
|
949
|
+
* - If the URL is a web URL (http or https scheme) and the current app is a browser, the URL is opened in the current app.
|
|
950
|
+
* - Otherwise, PopClip asks macOS to open the URL in the default handler for its scheme.
|
|
965
951
|
*
|
|
966
952
|
* Any parameters etc. in the URL must be appropriately percent-encoded. JavaScript provides the
|
|
967
953
|
* [encodeURIComponent()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent)
|
|
968
|
-
* function for this.
|
|
954
|
+
* function for this. Alternatively you can use the [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) class,
|
|
955
|
+
* which is available as a global in PopClip's JavaScript environment.
|
|
969
956
|
*
|
|
970
|
-
*
|
|
957
|
+
* @example
|
|
971
958
|
* ```js
|
|
972
|
-
*
|
|
973
|
-
* popclip.openUrl("https://xkcd.com"
|
|
974
|
-
* popclip.openUrl(
|
|
959
|
+
* // examples using string URLs
|
|
960
|
+
* popclip.openUrl("https://xkcd.com"); // open in current/default browser
|
|
961
|
+
* popclip.openUrl("https://xkcd.com", {app: "com.brave.Browser"}); // open in Brave browser
|
|
962
|
+
*
|
|
963
|
+
* // example using URL class
|
|
964
|
+
* const mailUrl=new URL("mailto:support@pilotmoon.com");
|
|
965
|
+
* mailUrl.searchParams.append("subject", "What's up?");
|
|
966
|
+
* popclip.openUrl(mailUrl); // the mailto: link will open in the default mail application
|
|
975
967
|
* ```
|
|
976
968
|
*
|
|
977
|
-
* @param url URL string
|
|
978
|
-
* the `href` property is used as the URL but with `+` characters replaced with `%20`.)
|
|
969
|
+
* @param url URL string or a {@link UrlObject} representing the URL to open.
|
|
979
970
|
* @param options Options.
|
|
980
971
|
*/
|
|
981
|
-
openUrl
|
|
982
|
-
url: string |
|
|
972
|
+
openUrl(
|
|
973
|
+
url: string | UrlObject,
|
|
983
974
|
options?: {
|
|
984
975
|
/**
|
|
985
976
|
* Bundle identifier of the app to open the URL with. For example `"com.google.Chrome"`.
|
|
@@ -990,16 +981,16 @@ interface PopClip {
|
|
|
990
981
|
*/
|
|
991
982
|
activate?: boolean;
|
|
992
983
|
/**
|
|
993
|
-
*
|
|
984
|
+
* When opening a web URL in a supported browser, whether to open the URL in a background tab. (Default: `false`)
|
|
994
985
|
*/
|
|
995
986
|
backgroundTab?: boolean;
|
|
996
987
|
},
|
|
997
|
-
)
|
|
988
|
+
): void;
|
|
998
989
|
|
|
999
990
|
/**
|
|
1000
991
|
* Share items with a named macOS sharing service.
|
|
1001
992
|
*
|
|
1002
|
-
*
|
|
993
|
+
* @example
|
|
1003
994
|
* ```js
|
|
1004
995
|
* // share a string with the Messages service
|
|
1005
996
|
* popclip.share("com.apple.share.Messages.window", ["Hello, world!"]);
|
|
@@ -1010,18 +1001,13 @@ interface PopClip {
|
|
|
1010
1001
|
* popclip.share("com.apple.Notes.SharingExtension", [item]);
|
|
1011
1002
|
* ```
|
|
1012
1003
|
*
|
|
1013
|
-
* #### Notes
|
|
1014
|
-
*
|
|
1015
1004
|
* The list of available sharing services is determined by the user's system configuration.
|
|
1016
1005
|
*
|
|
1017
|
-
* @param serviceName The name of the sharing service to use.
|
|
1018
|
-
* @param items An array of items to share. Each item can be a string, a {@link RichString} object, or
|
|
1006
|
+
* @param serviceName The name of the sharing service to use. Available names can be found by calling {@link util.sharingServicesInfo}.
|
|
1007
|
+
* @param items An array of items to share. Each item can be a string, a {@link RichString} object, or a {@link UrlObject}.
|
|
1019
1008
|
* @throws If the service name is not recognized, or if the service cannot handle the supplied items, an error is thrown.
|
|
1020
1009
|
*/
|
|
1021
|
-
share: (
|
|
1022
|
-
serviceName: string,
|
|
1023
|
-
items: (string | RichString | { url: string })[],
|
|
1024
|
-
) => void;
|
|
1010
|
+
share(serviceName: string, items: (string | RichString | UrlObject)[]): void;
|
|
1025
1011
|
}
|
|
1026
1012
|
|
|
1027
1013
|
/**
|
|
@@ -1051,8 +1037,8 @@ interface Util {
|
|
|
1051
1037
|
};
|
|
1052
1038
|
|
|
1053
1039
|
/**
|
|
1054
|
-
|
|
1055
|
-
|
|
1040
|
+
* Get information about the current time zone as configured in macOS settings.
|
|
1041
|
+
*/
|
|
1056
1042
|
timeZoneInfo: {
|
|
1057
1043
|
identifier: string;
|
|
1058
1044
|
abbreviation: string;
|
|
@@ -1060,6 +1046,11 @@ interface Util {
|
|
|
1060
1046
|
daylightSaving: boolean;
|
|
1061
1047
|
};
|
|
1062
1048
|
|
|
1049
|
+
/**
|
|
1050
|
+
* Get infomation about available sharing services for {@link popclip.share}.
|
|
1051
|
+
*/
|
|
1052
|
+
sharingServicesInfo: string;
|
|
1053
|
+
|
|
1063
1054
|
htmlToRtf(html: string): string | undefined;
|
|
1064
1055
|
|
|
1065
1056
|
/**
|
|
@@ -1116,7 +1107,7 @@ interface Util {
|
|
|
1116
1107
|
* This aims work like `crypto.getRandomValues()` from Web Crypto API.
|
|
1117
1108
|
* Internally, it is implemented using Apple's `SecRandomCopyBytes`.
|
|
1118
1109
|
*
|
|
1119
|
-
*
|
|
1110
|
+
* @example
|
|
1120
1111
|
*
|
|
1121
1112
|
* ```js
|
|
1122
1113
|
* const array = new Uint8Array(16); // array of 16 bytes
|
|
@@ -1217,10 +1208,18 @@ interface Util {
|
|
|
1217
1208
|
* Represents the raw pasteboard content, indexed by UTI. Supports string data only.
|
|
1218
1209
|
*/
|
|
1219
1210
|
interface PasteboardContent {
|
|
1211
|
+
/**
|
|
1212
|
+
* The UTF-8 plain text content of the pasteboard.
|
|
1213
|
+
*/
|
|
1220
1214
|
"public.utf8-plain-text"?: string;
|
|
1215
|
+
/**
|
|
1216
|
+
* The HTML content of the pasteboard.
|
|
1217
|
+
*/
|
|
1221
1218
|
"public.html"?: string;
|
|
1219
|
+
/**
|
|
1220
|
+
* The RTF content of the pasteboard.
|
|
1221
|
+
*/
|
|
1222
1222
|
"public.rtf"?: string;
|
|
1223
|
-
[key: string]: string | undefined;
|
|
1224
1223
|
}
|
|
1225
1224
|
|
|
1226
1225
|
/**
|
|
@@ -1234,6 +1233,16 @@ interface PasteOptions {
|
|
|
1234
1233
|
restore?: boolean;
|
|
1235
1234
|
}
|
|
1236
1235
|
|
|
1236
|
+
/**
|
|
1237
|
+
* Options for Copy operations.
|
|
1238
|
+
*/
|
|
1239
|
+
interface CopyOptions {
|
|
1240
|
+
/**
|
|
1241
|
+
* Whether to show the "Copied" notification to the user. (Default: `true`)
|
|
1242
|
+
*/
|
|
1243
|
+
notify?: boolean;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1237
1246
|
/**
|
|
1238
1247
|
* A simplified interface to the macOS pasteboard. Implemented by the global object, {@link pasteboard}.
|
|
1239
1248
|
*/
|
|
@@ -1241,7 +1250,6 @@ interface Pasteboard {
|
|
|
1241
1250
|
/**
|
|
1242
1251
|
* Get and set the plain text content of the pasteboard.
|
|
1243
1252
|
*
|
|
1244
|
-
* #### Notes
|
|
1245
1253
|
* This property corresponds with the pasteboard type `public.utf8-plain-text`.
|
|
1246
1254
|
*
|
|
1247
1255
|
* When placing text on the pasteboard this way, PopClip's "Copied" notification will not appear.
|
|
@@ -1250,7 +1258,7 @@ interface Pasteboard {
|
|
|
1250
1258
|
* The value of this property will always be a string. If there is no plain text value on the
|
|
1251
1259
|
* pasteboard, reading this property will give an empty string (`""`).
|
|
1252
1260
|
*
|
|
1253
|
-
*
|
|
1261
|
+
* @example
|
|
1254
1262
|
* ```js
|
|
1255
1263
|
* let x = pasteboard.text;
|
|
1256
1264
|
* pasteboard.text = "new text";
|
|
@@ -1270,11 +1278,45 @@ interface Pasteboard {
|
|
|
1270
1278
|
*/
|
|
1271
1279
|
declare const popclip: PopClip;
|
|
1272
1280
|
|
|
1281
|
+
/**
|
|
1282
|
+
* The `UrlObject` type is used for passing URL parameters into some methods. It can be either an object with a `url` property,
|
|
1283
|
+
* or an object with an `href` property.
|
|
1284
|
+
*
|
|
1285
|
+
* - If the object has a `url` property, the value of that property is used as the URL.
|
|
1286
|
+
* - If the object has an `href` property, the that string is first processed to replace all `+` with `%20` and then used as the URL.
|
|
1287
|
+
* - If the object has both `url` and `href` properties, the `url` property is used.
|
|
1288
|
+
*
|
|
1289
|
+
* The rationale for this is that [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) objects in JavaScript provide
|
|
1290
|
+
* the `href` property, with spaces encoded as `+`. Most modern APIs expect spaces to be encoded as `%20`, so this behaviour
|
|
1291
|
+
* allows URL objects to be passed in to methods that want a url, without needing to manually re-encode spaces.
|
|
1292
|
+
*
|
|
1293
|
+
* @example
|
|
1294
|
+
* ```js
|
|
1295
|
+
* const exampleUrl=new URL("https://example.com/path");
|
|
1296
|
+
* exampleUrl.searchParams.set("q","query with spaces");
|
|
1297
|
+
* print(exampleUrl.href)); // this will print "https://example.com/path?q=query+with+spaces"
|
|
1298
|
+
* popclip.openUrl(exampleUrl); // this will open "https://example.com/path?q=query%20with%20spaces"
|
|
1299
|
+
* ```
|
|
1300
|
+
*/
|
|
1301
|
+
declare type UrlObject =
|
|
1302
|
+
| {
|
|
1303
|
+
/**
|
|
1304
|
+
* String to be used as-is.
|
|
1305
|
+
*/
|
|
1306
|
+
url: string;
|
|
1307
|
+
}
|
|
1308
|
+
| {
|
|
1309
|
+
/**
|
|
1310
|
+
* String in which PopClip will replace `+` characters with `%20` before use.
|
|
1311
|
+
*/
|
|
1312
|
+
href: string;
|
|
1313
|
+
};
|
|
1314
|
+
|
|
1273
1315
|
/**
|
|
1274
1316
|
* Represents a formatted text string. The underlying implementation uses a macOS Attributed String (`NSAttributedString`) object.
|
|
1275
1317
|
* Can be constructed from a plain string in RTF, HTML, or Markdown format.
|
|
1276
1318
|
*
|
|
1277
|
-
*
|
|
1319
|
+
* @example
|
|
1278
1320
|
* ```js
|
|
1279
1321
|
* // create a RichString object from a html string
|
|
1280
1322
|
* const item = new RichString("<b>bold</b> and <i>italic</i>.", {format: 'html'});
|
|
@@ -1326,7 +1368,7 @@ declare const pasteboard: Pasteboard;
|
|
|
1326
1368
|
*
|
|
1327
1369
|
* then Quit and restart PopClip.
|
|
1328
1370
|
*
|
|
1329
|
-
*
|
|
1371
|
+
* @example
|
|
1330
1372
|
* ```js
|
|
1331
1373
|
* print("Hello, world!")
|
|
1332
1374
|
* // print: Hello, world!
|
|
@@ -1340,7 +1382,7 @@ declare function print(...args: any[]): void;
|
|
|
1340
1382
|
|
|
1341
1383
|
/**
|
|
1342
1384
|
* A promise-based sleep function. Included as a more convenient alternative
|
|
1343
|
-
* to
|
|
1385
|
+
* to setTimeout for performing simple delays. Call as `await sleep(1000)`.
|
|
1344
1386
|
* @param durationMilliseconds How long to sleep in milliseconds
|
|
1345
1387
|
*/
|
|
1346
1388
|
declare function sleep(durationMilliseconds: number): Promise<void>;
|