2. Why async?
◉ Because of modularity of server side app:
- data-mage-init
- Layout XML declarations
- UI Components XML declarations
◉ Asynchronous JavaScript modules loaders
◉ Many user interactions are asynchronous
◉ Performance considerations
3. How to maintain async?
new MutationObserver (
function(mutations) {
// array of MutationRecord
}
);
Browser Chrome Firefox
Internet
Explorer
Opera Safari
Starting from 18 14 11 15 6.0
7. Practice 0: remote control
require(['uiRegistry'], function (reg) {
var c = reg.get('index=customer_columns');
c.insertChild(c.getChild('name'), c.getChild('gender'));
});
8. Practice 1: Apply Filter
require(['uiRegistry'], function (reg) {
var c = reg.get('index=listing_filters');
c.setData({"email":”user_1@example.com"}).apply();
});
9. Practice 1: Apply Filter
require(['uiRegistry'], function (reg) {
var c = reg.get('index=customer_listing_data_source');
c.set('params.filters.email', ’user_2@example.com ');
});
does not work
10. Practice 1: Apply Filter
// hack filters.js (change “exports” to “links”)
require(['uiRegistry'], function (reg) {
var c = reg.get('index=customer_listing_data_source');
c.set('params.filters.email', 'user_2@example.com');
});
16. Practice 4 (see UiWorkshop module)
Adding
‘goToFirstPage’
and ‘goToLastPage’
buttons to pager
17. Practice 5 (see UiWorkshop module)
Disable ’save’ button
in inline editor
unless something
has changed
18. Practice 6 (see UiWorkshop module)
Improving keyboard
navigation on
Categories selection
tree
Editor's Notes
MutationObserver provides developers a way to react to changes in a DOM. It is designed as a replacement for Mutation Events defined in the DOM3 Events specification.