This repository has been archived on 2023-08-29. You can view files and clone it, but cannot push or open issues/pull-requests.
yutent
/
anot.js
Archived
1
0
Fork 0
anot.js/src/14-buffer.js

27 lines
537 B
JavaScript

//使用来自游戏界的双缓冲技术,减少对视图的冗余刷新
var Buffer = function() {
this.queue = []
}
Buffer.prototype = {
render: function(isAnimate) {
if (!this.locked) {
this.locked = isAnimate ? root.offsetHeight + 10 : 1
var me = this
Anot.nextTick(function() {
me.flush()
})
}
},
flush: function() {
for (var i = 0, sub; (sub = this.queue[i++]); ) {
sub.update && sub.update()
}
this.locked = 0
this.queue = []
}
}
var buffer = new Buffer()
Anot 是Anot not only templateEngine的缩写。 它是一款迷你,易用、高性能的前端MVVM框架, fork于avalon。进行了大量的重构,精简部分冗余的API, 同时针对组件拓展进行了优化。
JavaScript 100%