MCPcopy
hub / github.com/blitz-js/blitz / evalAsync

Method evalAsync

integration-tests/utils/browsers/playwright.ts:278–297  ·  view source on GitHub ↗
(snippet)

Source from the content-addressed store, hash-verified

276 }
277
278 async evalAsync(snippet) {
279 if (typeof snippet === "function") {
280 snippet = snippet.toString()
281 }
282
283 if (snippet.includes(`var callback = arguments[arguments.length - 1]`)) {
284 snippet = `(function() {
285 return new Promise((resolve, reject) => {
286 const origFunc = ${snippet}
287 try {
288 origFunc(resolve)
289 } catch (err) {
290 reject(err)
291 }
292 })
293 })()`
294 }
295
296 return page.evaluate(snippet).catch(() => null)
297 }
298
299 async log() {
300 return this.chain(() => pageLogs) as any

Callers

nothing calls this directly

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected