提交 f7ee5032 编写于 作者: N Naoyuki Kanezawa 提交者: Guillermo Rauch

use Promise to update head (#574)

上级 1fbf3248
......@@ -10,14 +10,14 @@ const DOMAttributeNames = {
export default class HeadManager {
constructor () {
this.requestId = null
this.updatePromise = null
}
updateHead (head) {
// perform batch update
window.cancelAnimationFrame(this.requestId)
this.requestId = window.requestAnimationFrame(() => {
this.requestId = null
const promise = this.updatePromise = Promise.resolve().then(() => {
if (promise !== this.updatePromise) return
this.updatePromise = null
this.doUpdateHead(head)
})
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册