-
Notifications
You must be signed in to change notification settings - Fork 142
Improve Proxy documentation #3268
Comments
I've written a basic I think the main question is what to do about all the handler pages. The story with the handler object is I think: you construct a At the moment we document this with a hierarchy of pages like:
There are semantic problems with this that I think have a real effect on the usability of this documentation:
From a purist point of view, what I am tempted to do is:
But this will make the constructor page very long, and means we'll have to change the way So I think I'd like to:
@Elchi3 , what do you think? |
A close analogy to this seems to be the |
Thanks for this detailed research, Will! I think this problem reminds me of another debate in API docs, that I'd call "The Great Dictionary Debate": Should dictionaries, or generally, complex constructor parameters be split out into sub pages (or even pages in the main API namespace), or should they be presented inline? We haven't agreed on structures for this and so, yes, as you say, oftentimes our current structures make no sense semantically. That said, I like the plan you've proposed for Proxy handlers and I think this topic will come back once we talk about structuring API docs. For now, I'd say we can go ahead with restructuring like you've proposed and see how it feels. |
I've made all the changes proposed in #3268 (comment) and added BCD for the |
This came up in mdn/stumptown-content#447.
Our documentation for the JavaScript
Proxy
object is confusing and badly organized.The main page:
Proxy
describes theProxy
class, so it should have a "Constructor" section linking to a separate page describing its constructor.Instead it has "Syntax" that describes the constructor call. This is a pattern we've been removing the other JS docs.
But it also has "Instance methods" listing things like
handler.getPrototypeOf()
. These are not instance methods ofProxy
. They are functions you can define on thehandler
argument to theProxy
constructor. It is very confusing to organize them like this.I think we should have a new
Proxy()
constructor page, with a big section called "Handler methods", that describes all the handler methods, using content from the subpages ofhandler
. Correspondingly we should removehandler
and all the pages underneath it, and make them redirect to theProxy()
constructor page.This does mean that we will have a quite huge
Proxy()
constructor page, but at least its organization will make sense.We should also make sure the main
Proxy
page has a good description of how to use this and why you might want to. https://hacks.mozilla.org/2015/07/es6-in-depth-proxies-and-reflect/ is good source material here.The text was updated successfully, but these errors were encountered: