Added a basic DOM diff algorithm

This commit is contained in:
2017-06-21 18:44:20 +02:00
parent 9bd5e71205
commit b4a4e78c96
6 changed files with 77 additions and 14 deletions

View File

@ -1,6 +1,5 @@
import { Application } from "./Application"
import { AnimeNotifier } from "./AnimeNotifier"
import { Diff } from "./Diff"
// Save new data from an input field
export function save(arn: AnimeNotifier, input: HTMLInputElement | HTMLTextAreaElement) {
@ -108,11 +107,7 @@ export function addAnimeToCollection(arn: AnimeNotifier, button: HTMLElement) {
throw body
}
return fetch("/_" + arn.app.currentPath, {
credentials: "same-origin"
})
.then(response => response.text())
.then(html => Diff.update(arn.app.content, html))
return arn.reloadContent()
})
.catch(console.error)
.then(() => arn.loading(false))