MCPcopy Create free account
hub / github.com/Xu22Web/tech-study-js / openFrame

Function openFrame

tech-study.js:3582–3601  ·  view source on GitHub ↗

* @description 打开窗口 * @param url * @returns

(url, title)

Source from the content-addressed store, hash-verified

3580 * @returns
3581 */
3582async function openFrame(url, title) {
3583 // 设置 URL
3584 frame.src = url;
3585 // 等待元素
3586 await $_('.egg_frame');
3587 if (frame.ele) {
3588 // id
3589 id.value = generateMix(10);
3590 // 打开
3591 frame.closed = false;
3592 // 设置标题
3593 frame.title = title || '';
3594 // 等待页面加载
3595 await waitFrameLoaded(frame.ele);
3596 // 发送窗口 ID
3597 frame.ele.contentWindow?.postMessage({ id: id.value, closed: false }, url);
3598 return true;
3599 }
3600 return false;
3601}
3602/**
3603 * @description 关闭窗口
3604 */

Callers 1

waitTaskWinFunction · 0.70

Calls 3

$_Function · 0.70
generateMixFunction · 0.70
waitFrameLoadedFunction · 0.70

Tested by

no test coverage detected