Skip to content

Commit

Permalink
Merged in viewpool-functions (pull request #16)
Browse files Browse the repository at this point in the history
onObtain and onRealeaseView functions for viewpool
  • Loading branch information
rohanhc committed May 27, 2016
2 parents ecc7d82 + 574440e commit cda675e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ui/ViewPool.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ exports = Class('ViewPool', function () {
logger.warn("ViewPool created View:", view.getTag());
}
}
if (view.onObtain) {
view.onObtain(opts);
}
view._obtainedFromPool = true;
view.style.visible = true;
this._freshViewIndex++;
Expand All @@ -79,6 +82,10 @@ exports = Class('ViewPool', function () {
var released = false;
if (view._obtainedFromPool) {
released = true;

if (view.onReleaseView) {
view.onReleaseView();
}
view._obtainedFromPool = false;
view.style.visible = false;
var temp = views[this._freshViewIndex - 1];
Expand Down

0 comments on commit cda675e

Please sign in to comment.