bear-window-launcher
TypeScript icon, indicating that this package has built-in type declarations

1.0.17 • Public • Published

Bear Window Launcher

This is a window launcher for front-end compatibility with browser issues when using window.open.

NPM npm downloads npm npm

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 bear-window-launcher

Examples

use in your page/component:

import {Launcher} from 'bear-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 'bear-window-launcher';

Check OS

import Launcher, {
    checkIsMobile,
    checkIsAndroid,
    checkIsIOS,
} from 'bear-window-launcher';

License

MIT © imagine10255

Package Sidebar

Install

npm i bear-window-launcher

Weekly Downloads

18

Version

1.0.17

License

MIT

Unpacked Size

12.2 kB

Total Files

8

Last publish

Collaborators

  • imagine10255