Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@arms/rum-browser

Package Overview
Dependencies
Maintainers
0
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arms/rum-browser - npm Package Compare versions

Comparing version 0.0.27-beta.8 to 0.0.27-beta.9

2

lib/collector/exception/blank.d.ts
import { ICollector, IContext, RumEvent } from '@arms/rum-core';
import { WhiteScreenRule, CheckMoment, ConfigOptions, BlankTester } from '../../utils/blank/index';
import { WhiteScreenRule, CheckMoment, ConfigOptions, BlankTester } from '../../utils/blank';
export default class WhiteScreenCollector implements ICollector {

@@ -4,0 +4,0 @@ name: string;

@@ -1,3 +0,3 @@

"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=!0,exports["default"]=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_rumCore=require("@arms/rum-core"),_index=require("../../utils/blank/index"),_global=require("../../utils/global"),_url=require("browser/src/utils/url"),timer=null,eventRegistrationMap={LEAVE:function LEAVE(a){// TODO: 可能会替换为pagehide
return _global.document.addEventListener("beforeunload",a),function(){return _global.document.removeEventListener("beforeunload",a)}},ROUTE_CHANGE:function ROUTE_CHANGE(a,b){return"hash"===b?(_global.global.addEventListener("hashchange",a),function(){return _global.global.removeEventListener("hashchange",a)}):((0,_rumCore.interceptFunction)(_global.global.history,"pushState",a),(0,_rumCore.interceptFunction)(_global.global.history,"replaceState",a),_global.global.addEventListener("popstate",a),function(){_global.global.removeEventListener("popstate",a)})},ERROR:function ERROR(a){return _global.global.addEventListener("error",a),function(){return _global.global.removeEventListener("error",a)}},LOAD:function LOAD(a){return"complete"===_global.document.readyState?(setTimeout(a,0),function(){}):(_global.global.addEventListener("load",a),function(){return _global.global.removeEventListener("load",a)})}},WhiteScreenCollector=exports["default"]=/*#__PURE__*/function(){function a(){var a=this;this.name="white-screen-collector",this.observers=[],this.ctx=void 0,this.sendEvent=void 0,this.abort=function(){a.observers.forEach(function(a){return a()}),a.observers=[]},this.blankHandler=/*#__PURE__*/function(){var b=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function d(b,c){var e,f,g,h,i,j,k,l,m,n;return _regenerator["default"].wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(e=b.target,f=b.tester,g=b.delay,h=void 0===g?0:g,i=b.configOptions,j=void 0===i?{}:i,k=b.ignoreUrlList,l=void 0===k?[]:k,!(l.includes(_global.location.pathname)||l.includes(_global.location.hash))){d.next=3;break}return d.abrupt("return");case 3:if(m=_global.document.querySelector(e),m&&f){d.next=6;break}return d.abrupt("return");case 6:if((0,_index.testerValidator)(f)){d.next=9;break}return console.warn("[RUM] Invalid tester type. Expected either a function or a string."),d.abrupt("return");case 9:timer&&(clearTimeout(timer),timer=null),n=(0,_url.getCurrentURL)(),timer="LEAVE"!==c&&"ERROR"!==c?setTimeout(function(){a.blankChecker(f,m,j,c,n)},h):setTimeout(function(){a.blankChecker(f,m,j,c,n)},0);case 12:case"end":return d.stop()}},d)}));return function(){return b.apply(this,arguments)}}(),this.blankChecker=/*#__PURE__*/function(){var b=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function g(b,c,d,e,f){var h,i,j,k,l,m,n;return _regenerator["default"].wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return g.next=2,(0,_index.blankCheck)(b,c,d);case 2:if(h=g.sent,i=h.hasContent,j=h.message,k=void 0===j?"":j,l=h.snapshot,!i){g.next=9;break}return g.abrupt("return");case 9:m=a.ctx.session.getBaseEvent(),n=(0,_extends2["default"])({},m,{event_type:_rumCore.RumEventType.EXCEPTION,name:"A white screen occurs at "+e,type:"blank",message:k,snapshots:JSON.stringify((0,_extends2["default"])({},l,{when:e,url:f}))}),a.sendEvent(n),a.abort();case 13:case"end":return g.stop()}},g)}));return function(){return b.apply(this,arguments)}}()}var b=a.prototype;return b.setup=function setup(a,b){var c=this;this.ctx=a,this.sendEvent=b;var d=a.getConfig(),e=d.whiteScreen,f=d.spaMode;if(e){// 开启白屏监控
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=!0,exports["default"]=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_rumCore=require("@arms/rum-core"),_blank=require("../../utils/blank"),_global=require("../../utils/global"),_url=require("../../utils/url"),timer=null,eventRegistrationMap={LEAVE:function LEAVE(a){// TODO: 可能会替换为pagehide
return _global.document.addEventListener("beforeunload",a),function(){return _global.document.removeEventListener("beforeunload",a)}},ROUTE_CHANGE:function ROUTE_CHANGE(a,b){return"hash"===b?(_global.global.addEventListener("hashchange",a),function(){return _global.global.removeEventListener("hashchange",a)}):((0,_rumCore.interceptFunction)(_global.global.history,"pushState",a),(0,_rumCore.interceptFunction)(_global.global.history,"replaceState",a),_global.global.addEventListener("popstate",a),function(){_global.global.removeEventListener("popstate",a)})},ERROR:function ERROR(a){return _global.global.addEventListener("error",a),function(){return _global.global.removeEventListener("error",a)}},LOAD:function LOAD(a){return"complete"===_global.document.readyState?(setTimeout(a,0),function(){}):(_global.global.addEventListener("load",a),function(){return _global.global.removeEventListener("load",a)})}},WhiteScreenCollector=exports["default"]=/*#__PURE__*/function(){function a(){var a=this;this.name="white-screen-collector",this.observers=[],this.ctx=void 0,this.sendEvent=void 0,this.abort=function(){a.observers.forEach(function(a){return a()}),a.observers=[]},this.blankHandler=/*#__PURE__*/function(){var b=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function d(b,c){var e,f,g,h,i,j,k,l,m,n;return _regenerator["default"].wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(e=b.target,f=b.tester,g=b.delay,h=void 0===g?0:g,i=b.configOptions,j=void 0===i?{}:i,k=b.ignoreUrlList,l=void 0===k?[]:k,!(l.includes(_global.location.pathname)||l.includes(_global.location.hash))){d.next=3;break}return d.abrupt("return");case 3:if(m=_global.document.querySelector(e),m&&f){d.next=6;break}return d.abrupt("return");case 6:if((0,_blank.testerValidator)(f)){d.next=9;break}return console.warn("[RUM] Invalid tester type. Expected either a function or a string."),d.abrupt("return");case 9:timer&&(clearTimeout(timer),timer=null),n=(0,_url.getCurrentURL)(),timer="LEAVE"!==c&&"ERROR"!==c?setTimeout(function(){a.blankChecker(f,m,j,c,n)},h):setTimeout(function(){a.blankChecker(f,m,j,c,n)},0);case 12:case"end":return d.stop()}},d)}));return function(){return b.apply(this,arguments)}}(),this.blankChecker=/*#__PURE__*/function(){var b=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function g(b,c,d,e,f){var h,i,j,k,l,m,n;return _regenerator["default"].wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return g.next=2,(0,_blank.blankCheck)(b,c,d);case 2:if(h=g.sent,i=h.hasContent,j=h.message,k=void 0===j?"":j,l=h.snapshot,!i){g.next=9;break}return g.abrupt("return");case 9:m=a.ctx.session.getBaseEvent(),n=(0,_extends2["default"])({},m,{event_type:_rumCore.RumEventType.EXCEPTION,name:"A white screen occurs at "+e,type:"blank",message:k,snapshots:JSON.stringify((0,_extends2["default"])({},l,{when:e,url:f}))}),a.sendEvent(n),a.abort();case 13:case"end":return g.stop()}},g)}));return function(){return b.apply(this,arguments)}}()}var b=a.prototype;return b.setup=function setup(a,b){var c=this;this.ctx=a,this.sendEvent=b;var d=a.getConfig(),e=d.whiteScreen,f=d.spaMode;if(e){// 开启白屏监控
var g=e.detectionRules;Array.isArray(g)&&g.length&&g.forEach(function(a){a.test_when.forEach(function(b){var d=function(){try{c.blankHandler(a,b)}catch(a){console.warn("[RUM] Failed to inject blank handler: ",a)}},e=eventRegistrationMap[b];if(e){var g=e(d,f);c.observers.push(g)}})})}},b.destroy=function destroy(){this.abort()},a}();

@@ -1,2 +0,2 @@

import { IViewData, ResourceStatus, RumEvent } from "@arms/rum-core";
import { IViewData, ResourceStatus } from "@arms/rum-core";
export declare const ApiType: {

@@ -6,3 +6,4 @@ XHR: string;

};
export interface IApiAttr extends RumEvent {
export interface IApiAttr {
type?: string;
name?: string;

@@ -9,0 +10,0 @@ message?: string;

@@ -1,1 +0,1 @@

"use strict";exports.__esModule=!0,exports.location=exports.history=exports.global=exports.document=exports.VERSION=void 0;var global=exports.global=window,document=exports.document=window.document,location=exports.location=window.location,history=exports.history=window.history,VERSION=exports.VERSION='0.0.27-beta.8';
"use strict";exports.__esModule=!0,exports.location=exports.history=exports.global=exports.document=exports.VERSION=void 0;var global=exports.global=window,document=exports.document=window.document,location=exports.location=window.location,history=exports.history=window.history,VERSION=exports.VERSION='0.0.27-beta.9';
{
"name": "@arms/rum-browser",
"version": "0.0.27-beta.8",
"version": "0.0.27-beta.9",
"description": "arms rum javascript sdk for browser",

@@ -22,3 +22,2 @@ "author": "guangli.fj <guangli.fj@alibaba-inc.com>",

"build": "build-scripts build --skip-demo",
"prepublishOnly": "npm run build",
"test": "node ./__tests__/@arms/browser.test.js"

@@ -25,0 +24,0 @@ },

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc