What are requirejs-config.js `mixins`?

requirejs
javascript
checkout-agreements
requirejs-config
requirejs-config-mixin

(Dmitry Fedyuk) #1

A Magento 2 RequireJS “mixin” allows you to programmatically listen for the initial instantiation of any RequireJS module and manipulate that module before returning it.

alanstorm.com/the-curious-case-of-magento-2-mixins

Currently, Magento 2 uses requirejs-config.js mixins be the Magento_CheckoutAgreements module only:

1. Magento 2.1.0 RC2 - Magento 2.2.2

1.1. Magento/CheckoutAgreements/view/frontend/requirejs-config.js

1.2. Magento/CheckoutAgreements/view/frontend/web/js/model/place-order-mixin.js

1.3. Magento/CheckoutAgreements/view/frontend/web/js/model/set-payment-information-mixin.js

2. Before Magento 2.1.0 RC2

2.1. Magento/CheckoutAgreements/view/frontend/requirejs-config.js

2.2 app/code/Magento/CheckoutAgreements/view/frontend/web/js/model/place-order-mixin.js


(Dmitry Fedyuk) #2

How to extend a jQuery widget with a mixin?