Skip to content

Commit

Permalink
revert lazy-loading of command-prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
simbo committed Nov 17, 2023
1 parent fdefeec commit 6bdcd05
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { ColorThemeToggle } from './color-theme-toggle/color-theme-toggle';
import { CommandPrompt } from './command-prompt/command-prompt';
import { SvgIcon } from './svg-icon/svg-icon';
import { TypedText } from './typed-text/typed-text';

customElements.define('svg-icon', SvgIcon);
customElements.define('typed-text', TypedText);
customElements.define('color-theme-toggle', ColorThemeToggle);
customElements.define('command-prompt', CommandPrompt);
8 changes: 1 addition & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './index.scss';
import './components';

import { STARTED_TYPING_EVENT_NAME, STOPPED_TYPING_EVENT_NAME, TypedText } from './components/typed-text/typed-text';
import { STOPPED_TYPING_EVENT_NAME, TypedText } from './components/typed-text/typed-text';
import { ColorTheme } from './lib/color-theme';
import { handleEventOnce } from './lib/handle-event-once';

Expand All @@ -12,12 +12,6 @@ const ADDITIONAL_CONTENT_CLASS = 'has-additional-content';

const typedText = document.querySelector('typed-text') as TypedText;

handleEventOnce(typedText, STARTED_TYPING_EVENT_NAME, () => {
import('./components/command-prompt/command-prompt').then(({ CommandPrompt }) =>
customElements.define('command-prompt', CommandPrompt)
);
});

handleEventOnce(typedText, STOPPED_TYPING_EVENT_NAME, () => {
typedText.classList.add(INITIAL_CONTENT_CLASS);
typedText.after(document.createElement('command-prompt'));
Expand Down

0 comments on commit 6bdcd05

Please sign in to comment.