Chrome扩展程序弹出窗口始终位于顶部

问题描述:

我已经为个人需求开发了一个小小的chrome扩展程序.但是我不喜欢用户体验中的某些东西,包含应用程序的弹出窗口在失去焦点时会自动关闭.

I've developed a little chrome extension for personal needs. But there's something in the user experience I don't like, the pop-up containing the application automatically closes when it loses the focus.

我想控制关闭行为和/或创建一个始终弹出的窗口,我试图在Google,Chrome开发者论坛和API参考上找到自己的出路,但找不到一种实现目标的方法.

I would like to control the closing behaviour and/or create an always on top popup, I've tried to find my way on Google, Chrome dev forums and API ref but can't find a way to accomplish that.

查看本文:在此处使用面板启用:chrome://flags/#enable-panels

Enable using panels here: chrome://flags/#enable-panels

这是我用来创建面板的代码:

Here is the code I use to create a panel:

let window_id;
chrome.browserAction.onClicked.addListener(()=>{
  if(window_id === undefined){
    chrome.windows.create(
      {url:'panel.html', type:'panel', focused:true, width:150, height:162}
      ,_=>window_id = _.id
    );
  }else{
    chrome.windows.update(window_id, {focused:true});
  }
  chrome.windows.onRemoved.addListener(_=>_ === window_id? window_id = undefined:3);
});