link-jump-intercept
拦截浏览器跳转,包括点击 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
orgit 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)'
orgit 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 - 余聪