ScatterWebExtension popup window

2019-06-12 09:35:00

https://github.com/GetScatter/ScatterWebExtension/blob/9d0f0946f8f53fe56c9a52afbeb55cc72c41f8e4/src/copied/prompt.html

https://github.com/GetScatter/ScatterWebExtension/blob/9d0f0946f8f53fe56c9a52afbeb55cc72c41f8e4/src/services/NotificationService.js#L38

const getPopup = async () => {
            try {
                const url = apis.runtime.getURL('/prompt.html');

                // Notifications get bound differently depending on browser
                // as Firefox does not support opening windows from background.
                if(typeof browser !== 'undefined') {
                    const created = await apis.windows.create({
                        url,
                        height,
                        width,
                        type:'popup'
                    });

                    window.notification = notification;
                    return created;
                }
                else {
                    const win = window.open(url, 'ScatterPrompt', `width=${width},height=${height},resizable=0,top=${middleY},left=${middleX},titlebar=0`);
                    win.data = notification;
                    openWindow = win;
                    return win;
                }
            } catch (e) {
                console.log('notification error', e);
                return null;
            }
        }
当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »