bb-packcheck

0.0.1 • Public • Published

使用说明

该模块是为HMP系统开发的插件,负责页面审核功能.

###安装

npm install bb-pagecheck --save

###使用

var check = require('bb-pagecheck');
var option = {};
check('http://m.beibei.com',option)
	.then(data => {
    	//....
	});

###其中option允许进行如下配置

	{
    port : 12301,//端口
    interval : 50,//检查页面的频率
    userAgent : 'beibei',//mizhe //wexin
    device : {
        width : 750,
        height : 1206
    },//设备尺寸
    check : {
        page : {
            pageTitle : true,
            links : true,
            shareConf : true
        },
        console : {
            consoleMessage : true,
            error : true,
            alert : true,
            resourceError : true
        },
        resource : {
            resourceReceived : true,
            resourceRequested : false
        }
    },//检查项配置
    limit : {
        maxImageSize : 0.3 * 1024 * 1024,
        maxPageSize : 5 * 1024 * 1024
    },//限制
    pageType : 'hmp',//页面是type
    phantomPath : undefined
}

###调用成功后返回的数据格式(接收失败是success为false)

{
    success : true,
    result : [],
    launchSuggestion : true,
    originData : {
        error : [],
        alert : [],
        consoleMessage : [],
        resourceError : [],
        links : [],
        shareConf : '',
        resourceReceived : [],
        resourceRequested : [],
        pageTitle: '',
        pageSize : 0,
        loadTime : 0
    }
}

其中reuslt字段存放对数据的分析结果,originData中放入了页面测试的原始数据 launchSuggestion 是开发者对该页面是否可以上线的意见,可以作为使用者的参考 如有疑问,请联系模块作者

Readme

Keywords

Package Sidebar

Install

npm i bb-packcheck

Weekly Downloads

0

Version

0.0.1

License

ISC

Last publish

Collaborators

  • liyizhi