Base
Base class for all configurable classes.
Subclasses do not have to implement a constructor with its restriction of having to call super()
before there is a this reference. Subclasses instead implement a construct method which is
called by the Base constructor. This may call its super implementation at any time.
The Base constructor applies all configs to properties of the new instance. The instance
will have been configured after the super.construct(config) is called.
See the Class System documentation in the guides for more information.
Properties
4
Properties
4Returns a copy of the full configuration which was used to configure this object.
This property is set to true before the constructor returns.
This property is set to true by destroy after destruction.
It is also one of the few properties that remains on the object after returning from destroy(). This property
is often checked in code paths that may encounter a destroyed object (like some event handlers) or in the
destruction path during cleanup.
This property is set to true on entry to the destroy method. It remains on the objects after
returning from destroy(). If isDestroyed is true, this property will also be true, so
there is no need to test for both (for example, comp.isDestroying || comp.isDestroyed).
Functions
15
Functions
15Configuration
Merges the provided default configuration values with the existing defaults for this class (and its subclasses).
This method allows you to define additional or override existing default property values that apply to all instances of the class.
// All my input fields should be clearable
Field.applyDefaults({
clearable : true
});
| Parameter | Type | Description |
|---|---|---|
defaultsObj | Object<String, *> | An object with the default values to set. |
Events
Removes all event listeners that were registered with the passed names.
| Parameter | Type | Description |
|---|---|---|
name | String | Symbol | The name(s) of the event listeners to be removed. |
Lifecycle
Base implementation applies configuration.
Subclasses need only implement this if they have to initialize instance specific
properties required by the class. Often a construct method is
unnecessary. All initialization of incoming configuration properties can be
done in a set propName implementation.
| Parameter | Type | Description |
|---|---|---|
args | Object | Usually called with a config object, but accepts any params |
Base constructor, passes arguments to construct.
| Parameter | Type | Description |
|---|---|---|
args | Object | Usually called with a config object, but accepts any params |
Destroys the provided objects by calling their destroy method. Skips empty values or objects that are already destroyed.
Base.destroy(myButton, toolbar1, helloWorldMessageBox);
| Parameter | Type | Description |
|---|---|---|
args | Object | Objects to be destroyed |
Destroys this object.
doDestroy, isDestroying is set to true. After doDestroy returns,
isDestroyed is set to true.
Do not override this method in subclasses. To provide class-specific cleanup, implement doDestroy instead.
Classes implement this method to provide custom cleanup logic before calling super.doDestroy(). The general
pattern is as follows:
class Foo extends Base {
doDestroy() {
// perform custom cleanup
super.doDestroy();
}
}
This method is called by destroy which also prevents multiple calls from reaching doDestroy.
Prior to calling doDestroy, isDestroying is set to true. Upon return, the object is fully
destructed and isDestroyed is set to true.
Do not call this method directly. Instead call destroy.
Sets configuration options this object with all the properties passed in the parameter object. Timing is taken care of. If the setter of one config is called first, and references the value of another config which has not yet been set, that config will be set just in time, and the new value will be used.
| Parameter | Type | Description |
|---|---|---|
config | Object | An object containing configurations to change. |
Misc
Changes the value of a numeric property of this object smoothly over the specified duration.
| Parameter | Type | Description |
|---|---|---|
propertyName | String | The name of the property to change. |
newValue | Number | The new value to set. |
duration | Number | The duration of the change in milliseconds. |
easing | linear | easeInBack | easeOutBack | easeInOutBack | easeOutBounce | easeInOutBounce | easeInCirc | easeOutCirc | easeInOutCirc | easeInCubic | easeOutCubic | easeInOutCubic | easeInElastic | easeOutElastic | easeInOutElastic | easeInExpo | easeOutExpo | easeInOutExpo | easeInQuad | easeOutQuad | easeInOutQuad | easeInQuart | easeOutQuart | easeInOutQuart | easeInQuint | easeOutQuint | easeInOutQuint | easeInSine | easeOutSine | easeInOutSine | The easing function to use. |
Provides a way of calling callbacks which may have been specified as the name of a function and optionally adds scope resolution.
For example, if the callback is specified as a string, then if it is prefixed with 'this.'
then the function is resolved in this object. This is useful when configuring listeners
at the class level.
If the callback name is prefixed with 'up.' then the ownership hierarchy is queried
using the owner property until an object with the named function is present, then the
named function is called upon that object.
If a named function is not found, an error is thrown. If the function should be only called when present,
and may not be present, add a ? as a suffix.
| Parameter | Type | Description |
|---|---|---|
fn | String | function | The function to call, or the name of the function to call. |
thisObject | Object | The |
args | Object[] | The argument list to pass. |
Experimental helper function, extracts the currently used configs and wraps them as an app, downloading the resulting JS file.
This function is intended to simplify creating test cases for issue reporting on Bryntum's support forum.
Registers this class type with its Factory
Checks if an obj is of type using object's $$name property and doing string comparison of the property with the type parameter.
| Parameter | Type | Description |
|---|---|---|
type | String |
Applies one or more mixins to this class and returns the produced class constructor.
For example, instead of writing this:
class A extends Delayable(Events(Localizable(Base))) {
// ...
}
Using this method, one would write this:
class A extends Base.mixin(Localizable, Events, Delayable) {
// ...
}
If one of the mixins specified has already been mixed into the class, it will be ignored and not mixed in a second time.
| Parameter | Type | Description |
|---|---|---|
mixins | function |
Provides a way of locating callbacks which may have been specified as the name of a function and optionally adds scope resolution.
For example, if the callback is specified as a string, then if it is prefixed with 'this.'
then the function is resolved in this object. This is useful when configuring listeners
at the class level.
If the callback name is prefixed with 'up.' then the ownership hierarchy is queried
using the owner property until an object with the named function is present, then the
named function is called upon that object.
| Parameter | Type | Description |
|---|---|---|
handler | String | function | The function to call, or the name of the function to call. |
thisObj | Object | The |
enforceCallability | Boolean | Pass |
{ handler, thisObj }