msc-any-fullscreen-popup
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -18,3 +18,4 @@ import { _wcl } from './common-lib.js'; | ||
const custumEvents = { | ||
click: 'msc-any-fullscreen-popup-click' | ||
click: 'msc-any-fullscreen-popup-click', | ||
error: 'msc-any-fullscreen-popup-error' | ||
}; | ||
@@ -284,2 +285,4 @@ let popupWin; | ||
async _onClick() { | ||
const deniedError = 'Insufficient permissions or user activation.'; | ||
try { | ||
@@ -289,3 +292,3 @@ const { state } = await window.navigator.permissions.query({ name:'window-management' }); | ||
if (state === 'denied') { | ||
throw new Error('Please allow the Window Management permission for <msc-any-fullscreen-popup /> functionality.'); | ||
throw new Error(deniedError); | ||
} else if (state !== 'granted') { | ||
@@ -296,3 +299,11 @@ await window.getScreenDetails(); | ||
// other browser might not support Window Management permission | ||
console.warn(`${_wcl.classToTagName(this.constructor.name)}: ${err.message}`); | ||
let { message } = err; | ||
if (message !== deniedError) { | ||
message = 'Window management not supported.'; | ||
} | ||
console.warn(`${_wcl.classToTagName(this.constructor.name)}: ${message}`); | ||
this.#fireEvent(custumEvents.error, { message }); | ||
} | ||
@@ -299,0 +310,0 @@ |
{ | ||
"name": "msc-any-fullscreen-popup", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Imagine the feature to open a popup window in fullscreen mode. With window-management support, user could directly open a popup window in fullscreen mode in just one click.", | ||
@@ -5,0 +5,0 @@ "main": "index.html", |
@@ -150,2 +150,3 @@ # msc-any-fullscreen-popup | ||
| msc-any-fullscreen-popup-click | Fired when <msc-any-fullscreen-popup /> clicked. | | ||
| msc-any-fullscreen-popup-error | Fired when error occured. Developers could get message througn `event.detatil`. | | ||
@@ -157,2 +158,3 @@ ## Reference | ||
- [MDN > window.open](https://developer.mozilla.org/en-US/docs/Web/API/Window/open) | ||
- [<msc-any-fullscreen-popup /> demo](https://blog.lalacube.com/mei/webComponent_msc-any-fullscreen-popup.html) | ||
- [YouTube > tutorial](https://youtu.be/Z_uee448gDQ) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1209
159
64090