Skip to content

Commit

Permalink
Compile all ES6+ syntax to ES5
Browse files Browse the repository at this point in the history
Fixes flatpickr#2468.

Signed-off-by: Anders Kaseorg <[email protected]>
  • Loading branch information
andersk committed Jul 2, 2021
1 parent 804d1d2 commit 1761352
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ async function start() {
}
const watcher = rollup.watch([getConfig({ dev: true })]);

function exit() {
const exit = function () {
watcher.close();
watchers.forEach((w) => w.close());
}
};

//catches ctrl+c event
process.on("SIGINT", exit);
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/scrollPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Instance } from "../types/instance";
import { getEventTarget } from "../utils/dom";

if (typeof window.CustomEvent !== "function") {
function CustomEvent(
const CustomEvent = function (
typeArg: string,
eventInitDict?: CustomEventInit
): CustomEvent {
Expand All @@ -20,7 +20,7 @@ if (typeof window.CustomEvent !== "function") {
eventInitDict.detail
);
return evt;
}
};

CustomEvent.prototype = window.Event.prototype;

Expand Down
3 changes: 2 additions & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ export const int = (bool: boolean) => (bool === true ? 1 : 0);
export function debounce<F extends Function>(fn: F, wait: number) {
let t: NodeJS.Timeout;
return function (this: any) {
const args = arguments;
clearTimeout(t);
t = setTimeout(() => fn.apply(this, arguments), wait);
t = setTimeout(() => fn.apply(this, args), wait);
};
}

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"include": ["src"],
"compilerOptions": {
"incremental": true,
"target": "es6",
"target": "es5",
"module": "es2015",
"outDir": "dist/esm"
}
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"target": "es2015",
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"noUnusedLocals": true,
Expand Down

0 comments on commit 1761352

Please sign in to comment.