Socket
Book a DemoInstallSign in
Socket

@thangved/callback-window

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package version was removed
This package version has been unpublished, mostly likely due to security reasons

@thangved/callback-window

unpublished
Source
npmnpm
Version
1.1.4
Weekly downloads
32
3100%
Maintainers
1
Weekly downloads
 
Created
Source

Callback window

A simple handler for external website window callback

Install

Install this package via npm

npm i @thangved/callback-window

Or via yarn

yarn add @thangved/callback-window

Usage

import { startCallbackWindow } from '@thangved/callback-window';

const handleCallback = async () => {
  try {
    const { redirectedUrl } = await startCallbackWindow(
      'https://redirect.thangved.com/?redirect_uri=https://profile.thangved.com',
    );

    console.log(redirectedUrl); // https://profile.thangved.com
  } catch (error) {
    console.log(error);
  }
};

Options

OptionTypeDefaultDescription
timeoutnumberInfinityTime to close window in milliseconds
intervalnumber100Time to check current URL in milliseconds
shouldClose(currentUrl: string) => boolean | Promise<boolean>The window checker should be closed. By default, the window will close when the origin of the window equals the origin of the parent window
onBrowserNotAllowed(url: string) => voidWhat to do when the browser does not allow opening new windows; by default changes the current window address to the destination address

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts