
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
copper-tracker
Advanced tools
A tracker SDK
src corenavigator.sendBeacon()为什么要用这个去上报?
因为这个上报的机制与 XMLHttpRequest 对比 navigator.sendBeacon 即使在关闭了页面的情况下也会完成请求,而 XMLHttpRequest 则不一定。
解决函数调用时,ts this 的问题
思路 1:
在 tsconfig.json 文件中,将noImplicitThis的值改为 false
{
"noImplicitThis":false,
}
思路 2: 在函数创始之初,设置一个假参数,并指定类型为 any
const origin = history[type];
return function (this: any) {
const res = origin.apply(this, arguments);
return res;
};
主要是给需要监听的元素添加一个属性,来区分是否需要监听 target-key.
rollup.config.js filenpm init -y
tsc --init
npm install rollup -D
npm install rollup-plugin-dts -D
npm install rollup-plugin-typescript2 -D
npm install typescript -D
import path from "path";
import ts from "rollup-plugin-typescript2";
import dts from "rollup-plugin-dts";
export default [
// the first object aims to build ts to js
{
input: "./src/core/index.ts",
output: [
{
file: path.resolve(__dirname, "./dist/index.esm.js"),
/**
* es => import export
* cjs => require exports
* umd => AMD CMD global
*/
format: "es",
},
{
file: path.resolve(__dirname, "./dist/index.cjs.js"),
format: "cjs",
},
{
file: path.resolve(__dirname, "./dist/index.js"),
format: "umd",
name: "copper_tracker",
},
],
plugins: [ts()],
},
// the second object aims to produce .dts for the whole project
{
input: "./src/core/index.ts",
output: {
file: path.resolve(__dirname, "./dist/index.d.ts"),
format: "es",
},
plugins: [dts()],
},
];
{
"compilerOptions": {
// only change this. others keep!
"module": "ESNext"
}
}
{
"scripts": {
// add build command
"build": "rollup -c"
},
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"browser": "dist/index.js",
"types": "dist/types/index.d.ts",
"file": ["dist"]
}
FAQs
A tracker SDK
The npm package copper-tracker receives a total of 1 weekly downloads. As such, copper-tracker popularity was classified as not popular.
We found that copper-tracker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.