We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I currently see this as soon as the page loads:
[Error] Fatal error: Unexpectedly found nil while unwrapping an Optional value: file Sources/TokamakDOM/App/ColorSchemeObserver.swift, line 30
Not reproducible in other browsers in my testing
The text was updated successfully, but these errors were encountered:
I haven’t been able to reproduce this on my side but this change should help debug:
diff --git a/Sources/TokamakDOM/App/ColorSchemeObserver.swift b/Sources/TokamakDOM/App/ColorSchemeObserver.swift index 262acba..2bfebfa 100644 --- a/Sources/TokamakDOM/App/ColorSchemeObserver.swift +++ b/Sources/TokamakDOM/App/ColorSchemeObserver.swift @@ -25,7 +25,12 @@ enum ColorSchemeObserver { static func observe(_ rootElement: JSObjectRef) { let closure = JSClosure { - publisher.value = .init(matchMediaDarkScheme: $0[0].object!) + if let matchMediaDarkScheme = $0[0].object { + publisher.value = .init(matchMediaDarkScheme: matchMediaDarkScheme) + } else { + print($0) + _ = JSObjectRef.global.console.object!.log!($0[0]) + } return .undefined } _ = matchMediaDarkScheme.addEventListener!("change", closure)
Sorry, something went wrong.
Fix color scheme observer crashes in Safari (#249)
de37894
Resolve #245. Turns out `matchMediaDarkScheme` object doesn't have `addEventListener`, but only `addListener` in Safari 13.1.2.
Successfully merging a pull request may close this issue.
I currently see this as soon as the page loads:
Not reproducible in other browsers in my testing
The text was updated successfully, but these errors were encountered: