On 16/03/14, 16:13 , Paul Morris wrote:
> Good to know about these new APIs for Australis. I notice they are listed as "low-level" APIs on MDN. I'm just curious why they wouldn't be high-level instead?
We have a convention in SDK where API that have just one slash are
basically considered High Level API, because they're immediately after
the "sdk" namespace. However, in new components, we tried to avoid to
pollute the high level space with something like "sdk/action-button",
"sdk/toggle-button", "sdk/frame", "sdk/toolbar", also to give a more
organic folder structure (ActionButton and ToggleButton are both under
"button" folder, for example).
Nevertheless, they're High Level API to the core. In order to keep our
convention, we exposed a "sdk/ui" module that group all the new UI
components:
https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/ui
This also makes easier create add-on with multiple elements, such two
ToggleButton that opens one a Sidebar and one a Toolbar:
const { ToogleButton, Toolbar, Sidebar } = require("sdk/ui");
Instead of requires every single UI module.
Of course that is still possible, especially if your add-on use just one
ActionButton for example, you can requires just that:
const { ActionButton } = require("sdk/ui/button/action");