Skip to content

Commit

Permalink
onload => addDisposableListener
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackson Kearl committed Feb 4, 2021
1 parent 193173c commit 916c139
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,10 @@ export class GettingStartedPage extends Disposable {
const taskToExpand = assertIsDefined(this.currentCategory.content.items.find(task => task.id === id));

mediaElement.setAttribute('alt', taskToExpand.media.altText);
mediaElement.onload = () => mediaElement.width = mediaElement.naturalWidth * 2 / 3;
this.updateMediaSourceForColorMode(mediaElement, taskToExpand.media.path);
this.taskDisposables.add(this.themeService.onDidColorThemeChange(() => this.updateMediaSourceForColorMode(mediaElement, taskToExpand.media.path)));
this.taskDisposables.add(addDisposableListener(mediaElement, 'load', () => mediaElement.width = mediaElement.naturalWidth * 2 / 3));
this.taskDisposables.add(addDisposableListener(mediaElement, 'click', () => taskElement.querySelector('button')?.click()));
this.taskDisposables.add(this.themeService.onDidColorThemeChange(() => this.updateMediaSourceForColorMode(mediaElement, taskToExpand.media.path)));
taskElement.classList.add('expanded');
} else {
this.editorInput.selectedTask = undefined;
Expand Down

0 comments on commit 916c139

Please sign in to comment.