JS_0081:杂记:window.opener 模拟程序阻断2分钟

 
!window.opener:这部分检查window.opener是否存在。
如果window.opener是null或undefined,则!window.opener为true。
window.opener可能不存在的情况包括:
当前窗口不是由另一个窗口打开的(例如,直接在地址栏输入URL或通过书签打开的页面),
或者当前页面是通过某些方式设置为不允许访问opener的(例如,某些浏览器的安全策略)。

 

 

模拟程序阻断2分钟

app.post('/uploadText', async (req, res) => {

  UserData.taskType = 'genMod';
  const { data } = req.body;
  console.log(data);

  // 模拟等待两分钟
  await new Promise(resolve => setTimeout(resolve, 12000));
  
  UserData.task_id = '27cb84a3-2795-450a-be62-e3a3356f4374';
  res.json({
    message: '文件上传成功!',
    filePath: `http://localhost:${PORT}/downloads/${UserData.task_id}.glb`
  });

});

 

posted @ 2024-10-13 17:34  琥珀君  阅读(111)  评论(0)    收藏  举报