Skip to content

Commit

Permalink
[Latte] Call dispatchEvent directly in document
Browse files Browse the repository at this point in the history
  • Loading branch information
tung2744 committed Oct 19, 2023
1 parent 0a36be1 commit 53f0a81
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/Latte+WKWebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ class LatteWKWebView: WKWebView, WKNavigationDelegate {

func dispatchSignal(signal: LatteBuiltInSignals) {
self.evaluateJavaScript("""
window.dispatchSignal("\(signal.rawValue)");
document.dispatchEvent(
new CustomEvent("latte:signal", {
detail: { type: "\(signal.rawValue)" },
})
);
""")
}

Expand Down

0 comments on commit 53f0a81

Please sign in to comment.