If you're looking for a simple way to understand this, try creating a new class, overriding onClassExtended, and using console.log twice to capture the values.
However, if you prefer a more complex approach, delve into the ExtJS codebase to search for onClassExtended. Tools like Notepad++ offer useful search functionalities across directories, especially when working with ExtJS.
You'll discover that the property is primarily processed in packages\core\src\class\Class.js, around line 347, where it merely adds the function to $onExtended. Further investigation reveals that $onExtended is typically invoked within triggerExtended(), which in turn derives from packages\core\src\class\Class.js, starting at line 347 (before adding the current class's onClassExtended to the list!)
Class.triggerExtended.apply(Class, arguments);
along with
function(Class, data, hooks) {
suggests that cls involves information from Class, while data incorporates details from the extend method.
From analyzing the code, it appears that these two parameters correspond to the ones used in Ext.define:
Ext.define(
'MyApp.data.Test', // <- Class
{ // data object
extend:'Ext.class.Base' // <- "data.extend" is deleted in line 357
...
}
);
The insights gained indicate that onClassExtended enables defining a universal directive across all classes in a hierarchy, capable of altering class definitions. These directives execute sequentially, beginning from the most specialized class and progressing towards the base class, Ext.class.Base.
In contrast to constructors, these transformations occur during child class definition rather than instance creation.