You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
* Add example of a mixin for jQuery Widget and adjusted the mixin documentation
* Fixed the link
* Adjusted the JS mixins documentation
* Fixed the issue with trailing spaces
Copy file name to clipboardExpand all lines: guides/v2.2/javascript-dev-guide/javascript/js_mixins.md
+60-18Lines changed: 60 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -38,33 +38,71 @@ This function accepts a target component(module) as an argument and returns a mo
38
38
39
39
This allows you to return a new instance of the target component with your modifications attached to it before it is used in the application.
40
40
41
-
### Example
41
+
### Examples
42
+
43
+
#### Extend UI Component
42
44
43
-
The following is an example of a mixin module that extends the `target` component with a function that introduces a new `blockVisibility` property to a column element.
45
+
The following is an example of a mixin that extends the `target` component with a function that introduces a new `blockVisibility` property to a column element.
$.widget('mage.modal', targetWidget, modalWidgetMixin); // the widget alias should be like for the target widget
102
+
103
+
return$.mage.modal; // the widget by parent alias should be returned
104
+
};
105
+
});
68
106
```
69
107
70
108
## Declaring a mixin
@@ -76,7 +114,7 @@ The mixins configuration in the `requirejs-config.js` associates a target compon
76
114
77
115
### Example
78
116
79
-
The following is an example of a `requirejs-config.js` file that adds the `columns-mixins`, defined in the previous example, to the [grid column component].
117
+
The following is an example of a `requirejs-config.js` file that adds the `columns-mixin` and `modal-widget-mixin` mixins, defined in the previous examples, to the [grid column component][] and [modal widget][].
0 commit comments