npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

xdo-browser-filter

v1.0.7

Published

浏览器兼容性校验组件

Downloads

14

Readme

xdo-browser-filter

浏览器兼容性校验组件

安装

  • browser
    <script src="https://xenodochial-hermann-adb1af.netlify.app/xdo-brower-filter.umd.js"></script>
  • npm
    npm i xdo-browser-filter

用法

xdo-browser-filter

xdoBrowserFilter.init({
    filter:{
        chrome:65,
        ie:10,
        firefox:53
    },
    action:function(res){
        if(!res){
            xdoBrowserFilter.full()
        }
    }
})

默认提示方式

<script src="https://github.com/meterXu/browser-filter/blob/master/public/xdo-brower-filter.umd.js"></script>
<script>
    window.onload=function (){
        xdoBrowserFilter.init({
            filter:{
                chrome:65,
                ie:10,
                firefox:53
            },
            action:function(res){
                if(!res){
                    xdoBrowserFilter.full()
                }
            }
        })
    }
</script>

自定义提示方式

browser-filter

<template>
    <Dialog
            title="提示"
            :visible.sync="dialogVisible"
            width="30%">
        <div>
            <i v-if="filter" class="el-icon-success" style="color:#67C23A;font-size: 100px"></i>
            <i v-else class="el-icon-warning" style="color:#E6A23C;font-size: 100px"></i>
        </div>
        <div style="margin-top: 20px">
            {{ msg }}
        </div>
        <span slot="footer" class="dialog-footer" style="display: flex;justify-content: center">
          <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
      </span>
    </Dialog>
</template>
<script>
    import 'element-ui/lib/theme-chalk/index.css'
    import {Dialog} from 'element-ui'
    import xdoBrowserFilter from 'xdo-browser-filter'
    export default {
        components:{Dialog},
        data(){
            return{
                dialogVisible:false
            }
        },
        mounted(){
            {
                xdoBrowserFilter.init({
                    filter: {
                        chrome: 65,
                        ie: 10,
                        firefox: 53,
                        safari: 12,
                    },
                    action: function (res) {
                        if(!res){
                            this.dialogVisible = true
                        }
                    }
                })
            }
        }
    }

</script>

browser-filter

import 'element-ui/lib/theme-chalk/index.css'
import {Message} from 'element-ui'
import xdoBrowserFilter from 'xdo-browser-filter'
export default {
    mounted(){
        let that = this
        xdoBrowserFilter.init({
            filter: {
                chrome: 65,
                ie: 10,
                firefox: 53,
                safari: 12,
            },
            action: function (res) {
                if(!res){
                    Message({
                        message: '页面有兼容性问题!',
                        type: 'warning'
                    })
                }
            }
        })
    }
}

browser-filter

import 'element-ui/lib/theme-chalk/index.css'
import {Notification} from 'element-ui'
import xdoBrowserFilter from 'xdo-browser-filter'
export default {
    mounted(){
        let that = this
        xdoBrowserFilter.init({
            filter: {
                chrome: 65,
                ie: 10,
                firefox: 53,
                safari: 12,
            },
            action: function (res) {
                if(!res){
                    Notification({
                        title: '通知',
                        message: '页面有兼容性问题!',
                        type: 'warning'
                    })
                }
            }
        })
    }
}

组件兼容性

  • vue
  • react
  • browser

初始化选项

| 参数 | 类型 | 默认值 | 描述 | | ---- | ---- | ---- | ---- | | filter | Object | {} |限定兼容的浏览器版本,格式{browser:version},browser可以使用ie,edge,firefox,opera,chrome,safari;version表示版本数值| | operator | String | >= | 兼容性比较符,可选>=,<=,== | | compare | Function(browser,version) | null | 可自定义兼容性比较函数,返回true或false | | action | Function(res) | null | 兼容性校验回调函数,res表示兼容性结果,true或false |

方法

| 函数 | 参数 | 描述 | | ---- | ---- | ---- | | full(text,url) | text:String,url:String | 全屏显示提示,可以配置提示文字及下载路径 |