Skip to content

Commit

Permalink
fix: executeJavaScript does not allow callback now, fixes `An object …
Browse files Browse the repository at this point in the history
…could not be cloned`
  • Loading branch information
KagamiChan committed Oct 6, 2024
1 parent 0012800 commit c60aae6
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions views/utils/game-utils.es
Original file line number Diff line number Diff line change
Expand Up @@ -531,15 +531,18 @@ export const getFleetSpeed = (shipsData) => ({

export async function isInGame() {
try {
return (
if (
document.querySelector('webview').getURL() ===
'http://www.dmm.com/netgame/social/-/gadgets/=/app_id=854854/' ||
(await new Promise((resolve, reject) => {
document
.querySelector('webview')
.executeJavaScript("document.querySelector('embed') !== null", (e) => resolve(e))
}))
)
'http://www.dmm.com/netgame/social/-/gadgets/=/app_id=854854/'
) {
return true
}

const exists =
(await document
.querySelector('webview')
?.executeJavaScript("document.querySelector('embed') !== null")) ?? false
return exists
} catch (e) {
return false
}
Expand Down

0 comments on commit c60aae6

Please sign in to comment.