@arms/rum-core
Advanced tools
Comparing version 0.0.23 to 0.0.25-beta.7
@@ -32,3 +32,5 @@ export declare enum RumEventType { | ||
cumulative_layout_shift?: number; | ||
first_input_time?: number; | ||
loading_time?: number; | ||
first_paint?: number; | ||
first_contentful_paint?: number; | ||
@@ -65,3 +67,3 @@ dom_interactive?: number; | ||
source?: string; | ||
type?: 'crash' | 'cutsom' | 'error'; | ||
type?: 'crash' | 'cutsom' | 'error' | 'blank'; | ||
name?: string; | ||
@@ -104,5 +106,8 @@ message?: string; | ||
id: string; | ||
type: AppType; | ||
name?: string; | ||
version?: string; | ||
channel?: string; | ||
env?: string; | ||
version?: string; | ||
type: AppType; | ||
package?: string; | ||
}; | ||
@@ -121,6 +126,32 @@ user: { | ||
}; | ||
device?: { | ||
id?: string; | ||
type?: string; | ||
brand?: string; | ||
model?: string; | ||
name?: string; | ||
}; | ||
os?: { | ||
type?: string; | ||
version?: string; | ||
container?: string; | ||
container_version?: string; | ||
}; | ||
geo?: { | ||
country?: string; | ||
country_id?: string; | ||
province?: string; | ||
province_id?: string; | ||
city?: string; | ||
city_id?: string; | ||
}; | ||
isp?: { | ||
id?: string; | ||
name?: string; | ||
}; | ||
net?: { | ||
model: string; | ||
model?: string; | ||
name?: string; | ||
}; | ||
events: Array<RumEvent>; | ||
} |
@@ -16,1 +16,13 @@ /** | ||
export declare function generateUUID(len?: number): string; | ||
/** | ||
* @desc 函数防抖 | ||
* @param func 回调函数 | ||
* @param wait 延迟执行毫秒数 | ||
*/ | ||
export declare function debounce(func: Function, wait: number): () => void; | ||
/** | ||
* @desc 函数延迟执行 | ||
* @param func 回调函数 | ||
* @param wait 延迟执行毫秒数 | ||
*/ | ||
export declare function delay(func: Function, wait: number, ...args: any[]): number; |
"use strict"; | ||
exports.__esModule = true; | ||
exports.debounce = debounce; | ||
exports.delay = delay; | ||
exports.generateGUID = generateGUID; | ||
exports.generateUUID = generateUUID; | ||
exports.interceptFunction = interceptFunction; | ||
var _is = require("./is"); | ||
/** | ||
@@ -65,2 +68,39 @@ * 劫持函数 | ||
return str.join(''); | ||
} | ||
/** | ||
* @desc 函数防抖 | ||
* @param func 回调函数 | ||
* @param wait 延迟执行毫秒数 | ||
*/ | ||
function debounce(func, wait) { | ||
var timer; | ||
if (!(0, _is.isFunction)(func)) { | ||
return; | ||
} | ||
return function () { | ||
var context = this; | ||
var args = arguments; | ||
if (timer) { | ||
clearTimeout(timer); | ||
} | ||
timer = setTimeout(function () { | ||
func.apply(context, args); | ||
}, wait); | ||
}; | ||
} | ||
/** | ||
* @desc 函数延迟执行 | ||
* @param func 回调函数 | ||
* @param wait 延迟执行毫秒数 | ||
*/ | ||
function delay(func, wait) { | ||
if (!(0, _is.isFunction)(func)) { | ||
return; | ||
} | ||
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | ||
args[_key2 - 2] = arguments[_key2]; | ||
} | ||
return setTimeout.apply(void 0, [func, +wait || 0].concat(args)); | ||
} |
@@ -7,1 +7,9 @@ /** | ||
export declare function round(num: number, decimals: 0 | 1 | 2 | 3 | 4): number; | ||
/** | ||
* 保留指定位数的小数 | ||
* @param num 原数据 | ||
* @param decimal 小数位数 | ||
* @param min 限制最小值,否则返回undefined | ||
* @returns | ||
*/ | ||
export declare function formatNumber(num: number, decimal?: number, min?: number): number; |
"use strict"; | ||
exports.__esModule = true; | ||
exports.formatNumber = formatNumber; | ||
exports.performDraw = performDraw; | ||
@@ -15,2 +16,30 @@ exports.round = round; | ||
return +num.toFixed(decimals); | ||
} | ||
/** | ||
* 保留指定位数的小数 | ||
* @param num 原数据 | ||
* @param decimal 小数位数 | ||
* @param min 限制最小值,否则返回undefined | ||
* @returns | ||
*/ | ||
function formatNumber(num, decimal, min) { | ||
if (decimal === void 0) { | ||
decimal = 3; | ||
} | ||
if (min === void 0) { | ||
min = 0; | ||
} | ||
if (!num) { | ||
return num; | ||
} | ||
var str = num.toString(); | ||
var index = str.indexOf('.'); | ||
if (index !== -1) { | ||
str = str.substring(0, decimal + index + 1); | ||
} else { | ||
str = str.substring(0); | ||
} | ||
var result = parseFloat(str); | ||
return result >= min ? result : undefined; | ||
} |
@@ -10,5 +10,5 @@ "use strict"; | ||
for (var i = 0; i < array.length; i += 1) { | ||
var _item = array[i]; | ||
if (predicate(_item, i)) { | ||
return _item; | ||
var item = array[i]; | ||
if (predicate(item, i)) { | ||
return item; | ||
} | ||
@@ -15,0 +15,0 @@ } |
{ | ||
"name": "@arms/rum-core", | ||
"version": "0.0.23", | ||
"version": "0.0.25-beta.7", | ||
"description": "arms rum javascript sdk core", | ||
@@ -5,0 +5,0 @@ "author": "guangli.fj <guangli.fj@alibaba-inc.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43696
1321