ARMS 前端监控 的上报模块(不带 ARMS SDK),用于简化 api 在页面中的使用。
$ tnpm i @aligov/arms-report -S
const report = require('@aligov/arms-report');
// report api call status, success or not
report.api(
apiName,
successOrFail,
spendTimeInMilliseconds,
optionalApiStatusCode,
optionalMsg
);
// report error information
report.error(errorInstance, optionalErrorPos);
// call retCode api method, argsList are retCode api args that put into list as it's order
report.call(method, argsList);
// setPage
report.setPage(pageName);
// sum
report.sum(key, value);
// avg
report.avg(key, value);
// setConfig info
report.setConfig(configObj);
tnpm publish
来发布到 tnpmimport report from '@aligov/components-arms-report';
report.sum('key', 'value');