js export destructuring assignment bug
js export destructuring assignment bug
export {...obj} ❌
import prom from 'promjs';
import axios from 'axios';
const registry = prom();
const url = 'http://metrics.xgqfrms.xyz/metrics/job/web-app';
const autoReport = (timer = 10000) => {
window.setInterval(() => {
axios.post(url, registry.metrics()).then(() => {
registry.reset();
});
}, timer);
};
const manualReport = () => {
axios.post(url, registry.metrics()).then(() => {
registry.reset();
});
};
const Metrics = {
autoReport,
manualReport,
};
export {
...Metrics,
};
export default Metrics;
export const {...obj} ✅
const Metrics = {
autoReport,
manualReport,
};
export const {
...Metrics,
};
export default Metrics;
promjs
https://www.npmjs.com/package/promjs
https://github.com/weaveworks/promjs
refs
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/14550775.html
未经授权禁止转载,违者必究!