uiClass library

The uiClass is an abstract class from which all components are extended. The uiClass is a low-level class and is rarely used as direct parent for UI components' classes.

uiClass source code is <Magento_Ui_module_dir>/view/base/web/js/lib/core/class.js, in the Magento Open Source GitHub repository: app/code/Magento/Ui/view/base/web/js/lib/core/class.js

Commonly used methods

The uiClass class introduces the architecture of UI components through the following methods:

As an example:

defaults: {
    myFirstProperty: 0,
    mySecondProperty: 1
}

//Before executing initConfig method:
console.log(this.myFirstProperty) // Undefined
console.log(this.mySecondProperty) // Undefined

//After executing initConfig method:
console.log(this.myFirstProperty) // 0
console.log(this.mySecondProperty) // 1

As an example:

initialize: function () {
    %yourMethodName%();

    return this;
}

As an example:

initialize: function () {
    this._super(); //_super will call parent's `initialize` method here

    return this;
}

Commonly used properties

The defaults property declares the list of properties of a UI component's instance. Also it declares communications between components if needed.

As an example:

defaults: {
    %yourCustomProperty%: '',
    imports: {
        %yourCustomProperty%: '%anotherComponentLink%',
        disabled: 'checked'
    }
}