Permalink
Browse files

Use destroyables not deferrables

  • Loading branch information...
ConradIrwin committed Jun 20, 2012
1 parent 0cb35a9 commit 4640500bf0d03a26c58357f77fcee4b0ac5cd991
Showing with 8 additions and 0 deletions.
  1. +8 −0 js/lib/destroyable.js
View
@@ -26,6 +26,12 @@ lib.destroyable = function (_public, _protected) {
return destroyable;
};
+ // Make the deferrable fail when the destroyable is destroyed.
+ _public.chainedDeferrable = function (deferrable) {
+ _public.onDestroy(deferrable.reject);
+ return deferrable;
+ };
+
// Either chain a DOM node to the current destroyable, or create a new <div> that will
// be destroyed when this destroyable is destroyed.
_public.destroyableDiv = function (node) {
@@ -35,4 +41,6 @@ lib.destroyable = function (_public, _protected) {
});
return node;
};
+
+ return _public;
};

0 comments on commit 4640500

Please sign in to comment.