Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/acrool/acrool-window-launcher
This is a window launcher for front-end compatibility with browser issues when using window.open.
https://github.com/acrool/acrool-window-launcher
launcher safari webview
Last synced: 3 months ago
JSON representation
This is a window launcher for front-end compatibility with browser issues when using window.open.
- Host: GitHub
- URL: https://github.com/acrool/acrool-window-launcher
- Owner: acrool
- License: mit
- Created: 2024-01-03T09:10:09.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-29T01:02:36.000Z (3 months ago)
- Last Synced: 2024-10-29T01:29:18.546Z (3 months ago)
- Topics: launcher, safari, webview
- Language: TypeScript
- Homepage: https://acrool-window-launcher.pages.dev/
- Size: 309 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
- awesome-react - Acrool Window Launcher - Promise Window Open (JS Utils)
- awesome-react - Acrool Window Launcher - Promise Window Open (JS Utils)
README
# Acrool Window Launcher
This is a window launcher for front-end compatibility with browser issues when using window.open.[![NPM](https://img.shields.io/npm/v/@acrool/window-launcher.svg?style=for-the-badge)](https://www.npmjs.com/package/@acrool/window-launcher)
[![npm](https://img.shields.io/bundlejs/size/@acrool/window-launcher?style=for-the-badge)](https://github.com/acrool/@acrool/window-launcher/blob/main/LICENSE)
[![npm](https://img.shields.io/npm/l/@acrool/window-launcher?style=for-the-badge)](https://github.com/acrool/window-launcher/blob/main/LICENSE)[![npm downloads](https://img.shields.io/npm/dm/@acrool/window-launcher.svg?style=for-the-badge)](https://www.npmjs.com/package/@acrool/window-launcher)
[![npm](https://img.shields.io/npm/dt/@acrool/window-launcher.svg?style=for-the-badge)](https://www.npmjs.com/package/@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
```bash
yarn add @acrool/window-launcher
```## Examples
use in your page/component:
```ts
import {Launcher} from '@acrool/window-launcher';const launcher = new Launcher({
readyUrl: '/loading.html',
isEnableCatchClose: true,
});// 1. open loading page
// 2. xhr requet
// 3. replace loading page to new url
launcher
.open(async () => {
const json = await axios.get('/url1.json');
return json.data.gameUrl;
})
.catch(e => {
logRef.current.append('\ncatch...');
})
.finally(() => {
logRef.current.append('\nfinally...');
});```
## Check Browser
```ts
import Launcher, {
checkIsMobile,
checkIsAndroid,
checkIsIOS,
getBrowser,
checkIsChromeBrowser,
checkIsSafariBrowser,
checkIsFirefoxBrowser,
checkIsEdgeBrowser,
checkIsLineBrowser,
checkIsFacebookBrowser, checkIsWebview, checkIsPWA
} from '@acrool/window-launcher';
```## Check OS
```ts
import Launcher, {
checkIsMobile,
checkIsAndroid,
checkIsIOS,
} from '@acrool/window-launcher';
```## In Global
Here, declare things that go in the global namespace, or augment
existing declarations in the global namespacetypings/global.d.ts
```ts
import {Launcher} from '@acrool/window-launcher';declare global {
interface Window {
ActiveXObject: string
dataLayer: any[]
launcher: Launcher
}
}
```tsconfig.json
```json
{
"files": [
"typings/global.d.ts"
]
}
```There is also a example that you can play with it:
[![Play react-editext-example](https://raw.githubusercontent.com/acrool/acrool-window-launcher/main/play-in-example-button.svg)](https://acrool-window-launcher.pages.dev)
## License
MIT © [Acrool](https://github.com/acrool) & [Imagine](https://github.com/imagine10255)