Skip to content

Commit bf7796e

Browse files
committed
only load package on enter
1 parent 2144c09 commit bf7796e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/appShell.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export class AppShell extends BaseCustomWebComponentConstructorAppend {
199199

200200
let loadAllImports = window.location.search.includes("loadAllImports");
201201

202-
const loadPkg = async (e) => {
202+
const loadPkg = async () => {
203203
const pkgName = this._npmInput.value;
204204
if (pkgName.startsWith('http://') || pkgName.startsWith('https://')) {
205205
const observedCustomElementsRegistry = new ObservedCustomElementsRegistry();
@@ -232,7 +232,11 @@ export class AppShell extends BaseCustomWebComponentConstructorAppend {
232232
}
233233
this._npmInput.value = '';
234234
}
235-
this._npmInput.onkeydown = loadPkg;
235+
this._npmInput.onkeydown = (event) => {
236+
if (event.key === 'Enter') {
237+
loadPkg();
238+
}
239+
};
236240
this._getNpm.onclick = loadPkg;
237241

238242
let code = "";

0 commit comments

Comments
 (0)