Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
34 lines (30 loc) · 1.43 KB

File metadata and controls

34 lines (30 loc) · 1.43 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import _CJavaScriptKit
/// Unwind Wasm module execution stack and rewind it after specified milliseconds,
/// allowing JavaScript events to continue to be processed.
/// **Important**: Wasm module must be [asyncified](https://emscripten.org/docs/porting/asyncify.html),
/// otherwise JavaScriptKit's runtime will throw an exception.
public func pauseExecution(milliseconds: Int32) {
_sleep(milliseconds)
}
extension JSPromise {
/// Unwind Wasm module execution stack and rewind it after promise resolves,
/// allowing JavaScript events to continue to be processed in the meantime.
/// - Parameters:
/// - timeout: If provided, method will return a failure if promise cannot resolve
/// before timeout is reached.
///
/// **Important**: Wasm module must be [asyncified](https://emscripten.org/docs/porting/asyncify.html),
/// otherwise JavaScriptKit's runtime will throw an exception.
public func syncAwait() -> Result<JSValue, JSValue> {
var kindAndFlags = JavaScriptValueKindAndFlags()
var payload1 = JavaScriptPayload1()
var payload2 = JavaScriptPayload2()
_syncAwait(jsObject.id, &kindAndFlags, &payload1, &payload2)
let result = RawJSValue(kind: kindAndFlags.kind, payload1: payload1, payload2: payload2).jsValue()
if kindAndFlags.isException {
return .failure(result)
} else {
return .success(result)
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.