Skip to content

Commit 0d4671f

Browse files
author
p01
committed
Throttle _listDocuments and make its callback pass a message type to the update method
1 parent 4d71f91 commit 0d4671f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/resource-manager/resource_service.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ cls.ResourceManagerService = function(view, network_logger)
1010

1111
cls.ResourceManagerService.instance = this;
1212

13+
var THROTTLE_DELAY = 250;
14+
1315
this._view = view;
1416
this._network_logger = network_logger;
1517
this._context = null;
@@ -38,14 +40,14 @@ cls.ResourceManagerService = function(view, network_logger)
3840
d.sameOrigin = cls.ResourceUtil.sameOrigin(this._documentURLHash[d.parentDocumentID], d.url);
3941
},this);
4042

41-
this._update({});
43+
this._update({type:'_handle_listDocuments'});
4244
};
4345

4446
this._listDocuments = function()
4547
{
4648
this._tag_requestListDocuments = window.tagManager.set_callback(this, this._handle_listDocuments );
4749
window.services['document-manager'].requestListDocuments(this._tag_requestListDocuments, []);
48-
};
50+
}.bind(this).throttle(THROTTLE_DELAY);;
4951

5052
this._populateDocumentResources = function(r)
5153
{

0 commit comments

Comments
 (0)