@acrool/window-launcher
v1.0.20
Published
This is a window launcher for front-end compatibility with browser issues when using window.open.
Downloads
45
Maintainers
Readme
Acrool Window Launcher
Features
- Supports window.open after asynchronous requests in iOS Safari.
- Supports whether to close the old window when opening a new one
- Provides browser detection (Safari, Firefox, IE, Wechat, Line, Facebook), default is Chrome.
Installation
yarn add @acrool/window-launcher
Examples
use in your page/component:
import {Launcher} from '@acrool/window-launcher';
const launcher = new Launcher({
readyUrl: '/ready_page'
});
// This is to support safari, so it must be
// Safari needs to pre-open tabs before requesting, other browsers do not need to
launcher.ready();
// async requet
const response = await fetch('/url1.json');
const json = await response.json();
launcher.open(json.data);
Check Browser
import Launcher, {
checkIsMobile,
checkIsAndroid,
checkIsIOS,
getBrowser,
checkIsChromeBrowser,
checkIsSafariBrowser,
checkIsFirefoxBrowser,
checkIsEdgeBrowser,
checkIsLineBrowser,
checkIsFacebookBrowser, checkIsWebview, checkIsPWA
} from '@acrool/window-launcher';
Check OS
import Launcher, {
checkIsMobile,
checkIsAndroid,
checkIsIOS,
} from '@acrool/window-launcher';
There is also a example that you can play with it: