This commit is contained in:
Eduard Urbach 2018-03-29 11:36:54 +02:00
parent 68c44d3d72
commit 91dce1895f
3 changed files with 5 additions and 15 deletions

View File

@ -207,9 +207,6 @@ export class Application {
} }
emit(eventName: string) { emit(eventName: string) {
document.dispatchEvent(new Event(eventName, { document.dispatchEvent(new Event(eventName))
"bubbles": true,
"cancelable": true
}))
} }
} }

View File

@ -1,4 +1,5 @@
import { TouchController } from "./TouchController" import { TouchController } from "./TouchController"
import { Diff } from "./Diff"
export class SideBar { export class SideBar {
element: HTMLElement element: HTMLElement
@ -20,11 +21,11 @@ export class SideBar {
} }
show() { show() {
this.element.classList.add("sidebar-visible") Diff.mutations.queue(() => this.element.classList.add("sidebar-visible"))
} }
hide() { hide() {
this.element.classList.remove("sidebar-visible") Diff.mutations.queue(() => this.element.classList.remove("sidebar-visible"))
} }
toggle() { toggle() {

View File

@ -15,15 +15,7 @@ export function plural(count: number, singular: string): string {
} }
export function canUseWebP(): boolean { export function canUseWebP(): boolean {
let canvas = document.createElement("canvas") return document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp") === 0
if(!!(canvas.getContext && canvas.getContext("2d"))) {
// WebP representation possible
return canvas.toDataURL("image/webp").indexOf("data:image/webp") === 0
} else {
// In very old browsers (IE 8) canvas is not supported
return false
}
} }
export function swapElements(a: Node, b: Node) { export function swapElements(a: Node, b: Node) {