From 8fe92b94ce5e1e2857d088752d94e19db7e3d8a8 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Sun, 17 Jun 2012 22:31:44 -0700 Subject: montage v11 merge into ninja Signed-off-by: Valerio Virgillito --- node_modules/montage/core/promise.js | 42 ++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'node_modules/montage/core/promise.js') diff --git a/node_modules/montage/core/promise.js b/node_modules/montage/core/promise.js index 7563a742..6477131d 100755 --- a/node_modules/montage/core/promise.js +++ b/node_modules/montage/core/promise.js @@ -263,6 +263,7 @@ var PrimordialPromise = Creatable.create({ self.Promise = this; rejections.push(self); errors.push(error ? (error.stack ? error.stack : error) : reason); + displayErrors(); return self; } }, @@ -676,22 +677,31 @@ var Promise = PrimordialPromise.create({}, { // Descriptor for each of the three var rejections = []; var errors = []; -// Live console objects are not handled on tablets -if (typeof window !== "undefined" && !window.Touch) { - - /* - * This promise library consumes exceptions thrown in callbacks so - * that they can be handled asynchronously. The exceptions get - * added to ``errors`` when they are consumed, and removed when - * they are handled. In many debuggers, the view of the reported - * array will update to reflect its current contents so you can - * always see if you have missed an error. - * - * This log will appear once for every time this module gets - * instantiated. That should be once per frame. - */ - console.log("Should be empty:", errors); -} +var errorsDisplayed = false; +var displayErrors = function () { + // Live console objects are not handled on tablets or in Node + if ( + !errorsDisplayed && + typeof window !== "undefined" && + !window.Touch && + typeof console === "object" + ) { + + /* + * This promise library consumes exceptions thrown in callbacks so + * that they can be handled asynchronously. The exceptions get + * added to ``errors`` when they are consumed, and removed when + * they are handled. In many debuggers, the view of the reported + * array will update to reflect its current contents so you can + * always see if you have missed an error. + * + * This log will appear once for every time this module gets + * instantiated. That should be once per frame. + */ + console.log("Should be empty:", errors); + errorsDisplayed = true; + } +}; exports.Promise = Promise; -- cgit v1.2.3