Confirmed users
82
edits
Sevenspade (talk | contribs) (→Where we're going: formatting) |
Sevenspade (talk | contribs) |
||
| Line 21: | Line 21: | ||
* Cut/Copy/Paste/Insert/Delete commands and context menu for both the domTree and domNode viewers | * Cut/Copy/Paste/Insert/Delete commands and context menu for both the domTree and domNode viewers | ||
* Ability to toggle showAnonymousNodes and showSubDocuments from the UI | * Ability to toggle showAnonymousNodes and showSubDocuments from the UI | ||
== Viewer authoring guidelines == | |||
Best practices and other things to consider when writing a viewer: | |||
* The viewer's |subject| setter should not try to detect whether the subject is the same as the one it's already inspecting. The Inspector's "refresh" command is implemented by sending to the viewer the same subject as the one it's already inspecting. This is helpful if there are no APIs for observing changes to the subject in order to automatically update the viewer UI. (If there *are* APIs for that and you're already using them, whether you detect this or not is moot, so go ahead and do that if you like.) | |||
* Be careful about implementing the viewer filter in such a way that it accepts or rejects an object based on that object's current ''state'', rather than the ''type'' of object it is. There's no guarantee that your filter will be called again on an object that it initially rejected but that would now pass. | |||
* If you're writing a viewer that only supports "Inspect Application" mode (i.e., its |subject| setter is a no-op and its filter is set to reject every potential subject), make sure not to dispatch a targetChanged notification during the viewer initialization sequence. Even if the viewer could in theory pick a target to use immediately after it's loaded, wait for the |inspectApplication| call before dispatching targetChanged. | |||
* Viewers SHOULD NOT set their own subject. It should always use the subject the Inspector provides for it. | |||
* Don't fire redundant "targetChanged" notifications. If the code path in your viewer that selects a target is executed, your viewer should check to see if it's the same target as the one it had the last time it sent out the "targetChanged" notification. If it's the same one, just stay quiet. If you're using |TargetChanger| (and you should be), you need not worry about this, because its |changeTarget| method will do this for you. | |||