link-jump-intercept
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

link-jump-intercept

Build status Test coverage NPM version NPM Downloads Prettier Conventional Commits

拦截浏览器跳转,包括点击 a 标签,window.open 方法;
一般可以用于拦截测试环境、线上环境互相跳转

Installation

npm install link-jump-intercept
# or use yarn
yarn add link-jump-intercept

Usage

import { register } from 'link-jump-intercept'

const unregister = register({
  onInterceptors: (nextUrl) => {
    // 阻止跳转线上
    return nextUrl.includes('online') ? false : true
  }
})

// 取消副作用
unregister()

Contributing

  • Fork it!
  • Create your new branch:
    git checkout -b feature-new or git checkout -b fix-which-bug
  • Start your magic work now
  • Make sure npm test passes
  • Commit your changes:
    git commit -am 'feat: some description (close #123)' or git commit -am 'fix: some description (fix #123)'
  • Push to the branch: git push
  • Submit a pull request :)

Authors

This library is written and maintained by 余聪, yucong@yuanfudao.com.

License

MIT - 余聪 🐟

Package Sidebar

Install

npm i link-jump-intercept

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

8.84 kB

Total Files

7

Last publish

Collaborators

  • moyuyc