Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console hooks #65

Closed
kriskowal opened this issue May 2, 2012 · 5 comments
Closed

Console hooks #65

kriskowal opened this issue May 2, 2012 · 5 comments

Comments

@kriskowal
Copy link
Owner

Q should send messages to the console when promises are manipulated so that a monitor like a Causeway logger or Web Inspector view can be attached.

The corresponding console API is not defined. This is an idea to start the thinking process:

console.deferred(deferred);
console.resolved(promise);
console.fulfilled(promise);
console.rejected(promise);
@domenic
Copy link
Collaborator

domenic commented May 2, 2012

To make sure I understand, the idea is that we test for the presence of console.fulfilled, and if it exists, call it whenever a promise is fulfilled?

@kriskowal
Copy link
Owner Author

That’s the idea. The intention of the design, however, is to provide enough information to an optional external interface to produce useful debugging information for a running system, without entraining all of the interface logic in Q. This feature should be developed in tandem with some kind of waterfall or tree visualization, preferably with arrows connecting causes and effects and icons or colors denoting the state of each promise. Ideally we could get such an interface on track to be included in Web Inspector or Firebug.

Also, ideally this interface would be able to receive messages for remote events as well, but let’s not push it.

@ForbesLindesay
Copy link
Collaborator

Would it be possible to listen for just rejections which happen with nobody to observe them? i.e. can you tell when a promise has been observed properly. If so then this would seem like a great plan, as you could very quickly write a basic system to ensure errors never go un-observed, and could build more complex (and awesome) debuggers later.

@kriskowal
Copy link
Owner Author

@Tuskan360 the latest release already does this as a stopgap. It posts "Should be empty: []" to the console log. This is a live array of all the rejections that have no handlers attached. When you create a rejection, the corresponding error gets added. When it is handled, it is removed from the array.

@domenic
Copy link
Collaborator

domenic commented Dec 11, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants