2 $.ajatus = $.ajatus || {};
4 $.ajatus.renderer_defaults = {
6 max_item_before_pool: 40
9 $.ajatus.renderer = function(settings) {
10 this.settings = $.extend($.ajatus.renderer_defaults, (settings || {}));
11 this.render_lock = false;
15 $.extend($.ajatus.renderer.prototype, {
16 add_item: function(callback, args) {
21 this.items.push(item);
22 $.ajatus.events.lock_pool.increase();
24 if (! this.render_lock) {
33 _on_tick: function() {
35 if (this.items.length == 0)
37 $.ajatus.events.lock_pool.count = 0;
40 this.items = $.grep(this.items, function(n, i){
41 if (i < _self.settings.tick_limit)
43 var functionToCall = eval(n.callback);
45 if (functionToCall.apply(functionToCall, n.args)) {
46 _self.done_items.push(i);
47 $.ajatus.events.lock_pool.decrease();
55 _create_lock: function() {
57 _self.render_lock = new $.ajatus.events.lock({
58 disable_application: false,
62 return $.ajatus.events.lock_pool.count == 0;
67 on_release: function(){_self._lock_finished();}
71 _lock_finished: function() {