diff --git a/.eslintrc.json b/.eslintrc.json index 1bbadb88c..2c4da6904 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -40,7 +40,7 @@ "globals": { // asssets "panzoom": "readonly", - //script.js + // script.js "log": "readonly", "debug": "readonly", "gradioApp": "readonly", @@ -57,7 +57,12 @@ "uiElementInSight": "readonly", "getUICurrentTabContent": "readonly", "waitForFlag": "readonly", - //ui.js + "logFn": "readonly", + // contextmenus.js + "generateForever": "readonly", + // contributors.js + "showContributors": "readonly", + // ui.js "opts": "writable", "sortUIElements": "readonly", "all_gallery_buttons": "readonly", @@ -79,7 +84,7 @@ "setTheme": "readonly", // settings.js "registerDragDrop": "readonly", - //extraNetworks.js + // extraNetworks.js "requestGet": "readonly", "getENActiveTab": "readonly", "quickApplyStyle": "readonly", diff --git a/javascript/script.js b/javascript/script.js index 3f380c3e3..4a14b255c 100644 --- a/javascript/script.js +++ b/javascript/script.js @@ -23,6 +23,16 @@ function gradioApp() { return elem.shadowRoot ? elem.shadowRoot : elem; } +function logFn(func) { + return async function () { // eslint-disable-line func-names + const t0 = performance.now(); + const returnValue = func(...arguments); + const t1 = performance.now(); + log(func.name, Math.round(t1 - t0) / 1000); + return returnValue; + }; +} + function getUICurrentTab() { return gradioApp().querySelector('#tabs button.selected'); } diff --git a/package.json b/package.json index c9333006c..2bb6269b6 100644 --- a/package.json +++ b/package.json @@ -16,11 +16,12 @@ "url": "git+https://github.com/vladmandic/automatic.git" }, "devDependencies": { - "esbuild": "^0.18.15", - "eslint": "^8.44.0", - "eslint-config-airbnb-base": "^15.0.0" + "esbuild": "^0.18.15" }, "dependencies": { + "eslint": "^8.57.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-plugin-import": "^2.29.1", "eslint-plugin-json": "^3.1.0" } }