Skip to content

Lifecycle hooks

See also

For an introduction to lifecycle hooks with examples, see the Lifecycle guide.

mounted

Runs after the instance is mounted.

Parameters

This method has no parameters.

Example

js
import { 
Base
} from '@studiometa/js-toolkit';
export default class
Component
extends
Base
{
static
config
= {
name
: 'Component',
log
: true,
};
mounted
() {
// Logs 'mounted' when the component is mounted this.
$log
('mounted');
} }

updated

Runs after the instance is updated.

Parameters

This method has no parameters.

Example

js
import { 
Base
} from '@studiometa/js-toolkit';
export default class
Component
extends
Base
{
static
config
= {
name
: 'Component',
log
: true,
};
updated
() {
// Logs 'updated' when the component is updated this.
$log
('updated');
} }

destroyed

Runs when the component is destroyed.

Parameters

This method has no parameters.

Example

js
import { 
Base
} from '@studiometa/js-toolkit';
export default class
Component
extends
Base
{
static
config
= {
name
: 'Component',
log
: true,
};
destroyed
() {
// Logs 'destroyed' when the component is destroyed this.
$log
('destroyed');
} }

terminated

Runs when the component is terminated.

Parameters

This method has no parameters.

Example

js
import { 
Base
} from '@studiometa/js-toolkit';
export default class
Component
extends
Base
{
static
config
= {
name
: 'Component',
log
: true,
};
terminated
() {
// Logs 'terminated' when the component is terminated this.
$log
('terminated');
} }

MIT Licensed