diff --git a/src/assets/javascripts/browser/element/_/index.ts b/src/assets/javascripts/browser/element/_/index.ts index c0bc4b758..680b08c1a 100644 --- a/src/assets/javascripts/browser/element/_/index.ts +++ b/src/assets/javascripts/browser/element/_/index.ts @@ -99,9 +99,9 @@ export function getElements( * * @return Element */ -export function createElement< - T extends keyof HTMLElementTagNameMap ->(tagName: T): HTMLElementTagNameMap[T] { +export function createElement( + tagName: T +): HTMLElementTagNameMap[T] { return document.createElement(tagName) } diff --git a/src/assets/javascripts/browser/media/index.ts b/src/assets/javascripts/browser/media/index.ts index b7712c793..e167fc6ab 100644 --- a/src/assets/javascripts/browser/media/index.ts +++ b/src/assets/javascripts/browser/media/index.ts @@ -20,8 +20,8 @@ * IN THE SOFTWARE. */ -import { Observable, fromEventPattern } from "rxjs" -import { shareReplay, startWith } from "rxjs/operators" +import { Observable, fromEvent } from "rxjs" +import { map, shareReplay, startWith } from "rxjs/operators" /* ---------------------------------------------------------------------------- * Functions @@ -36,10 +36,9 @@ import { shareReplay, startWith } from "rxjs/operators" */ export function watchMedia(query: string): Observable { const media = matchMedia(query) - return fromEventPattern(next => - media.addListener(() => next(media.matches)) - ) + return fromEvent(media, "change") .pipe( + map(ev => ev.matches), startWith(media.matches), shareReplay({ bufferSize: 1, refCount: true }) )