dojo / app

:rocket: Dojo 2 - an application framework.
http://dojo.io
Other
8 stars 14 forks source link

Better API for bulk registration #28

Closed kitsonk closed 8 years ago

kitsonk commented 8 years ago

Version and Environment:

Dojo2 version: 2.0.0-beta

Environment(s): all

Environment version(s): n/a

Enhancement

Currently the APIs for registering take an (id, item) arity, they should also handle a object literal map as well, where the ID is the property name and the item is the value of the property. It would enable the following:

const action1 = createAction();
const action2 = createAction();
const app = createApp({ defaultStore: widgetStore });
app.registerAction({
    action1,
    action2
});

As well as this makes it easier for end developers to load a module of actions where the exports on the module are the action singletons. This obviously could be applied to the other registration APIs as well.

kitsonk commented 8 years ago

Upon refection, it is sort of already possible using the loadDefinition API, though having the functionality on the discreet APIs would still make sense.

novemberborn commented 8 years ago

Should this be registerActions() or is overloading registerAction() enough?

Would you want the same for registerWidgetFactory?

kitsonk commented 8 years ago

I think we should just revisit this as the refresh of the functional DSL as part of #33.