19 lines
540 B
TypeScript
Raw Normal View History

2017-10-17 09:27:15 +00:00
import { AnimeNotifier } from "../AnimeNotifier"
// Load
export function load(arn: AnimeNotifier, element: HTMLElement) {
let url = element.dataset.url || (element as HTMLAnchorElement).getAttribute("href")
arn.app.load(url)
}
// Diff
export function diff(arn: AnimeNotifier, element: HTMLElement) {
let url = element.dataset.url || (element as HTMLAnchorElement).getAttribute("href")
2017-11-10 07:41:45 +00:00
2017-11-03 17:10:31 +00:00
arn.diff(url)
2017-11-10 07:41:45 +00:00
.then(() => {
// Avoid instant layout thrashing
arn.requestIdleCallback(() => arn.scrollTo(element))
})
2017-11-03 17:10:31 +00:00
.catch(console.error)
2017-10-17 09:27:15 +00:00
}