chore: mark slotflag and fix some bugs (#45)

* fix: reassign variable as component should work

* feat: remove `compatibleProps`

* feat: mark slotFlag

* chore: istanbul ignore in babel.config.js

* test: reassign variable as component should work
This commit is contained in:
Amour1688
2020-07-28 21:25:30 +08:00
committed by GitHub
parent ebbd992ba0
commit 89afeac355
8 changed files with 122 additions and 39 deletions

View File

@ -63,7 +63,7 @@ const compile = () => {
console.clear();
transform(src, {
babelrc: false,
plugins: [[babelPluginJSx, { transformOn: true }]],
plugins: [[babelPluginJSx, { transformOn: true, optimize: true }]],
ast: true,
}, (err, result = {}) => {
const res = result!;
@ -87,18 +87,17 @@ compile();
// update compile output when input changes
editor.onDidChangeModelContent(debounce(compile));
function debounce<T extends (...args: any[]) => any>(
function debounce<T extends(...args: any[]) => any>(
fn: T,
delay: number = 300
): T {
let prevTimer: number | null = null
delay = 300): T {
let prevTimer: number | null = null;
return ((...args: any[]) => {
if (prevTimer) {
clearTimeout(prevTimer)
clearTimeout(prevTimer);
}
prevTimer = window.setTimeout(() => {
fn(...args)
prevTimer = null
}, delay)
}) as any
fn(...args);
prevTimer = null;
}, delay);
}) as any;
}