
The VisibilityController class is used to control the visibility of anything that can be hidden or shown.
true if any entity’s visibility status is ‘HIDDEN’, false otherwise.true if any entity’s visibility status is ‘HIDING’, false otherwise.true if any entity’s visibility status is ‘SHOWING’, false otherwise.true if any entity’s visibility status is ‘VISIBLE’, false otherwise.The show method shows an entity. Optionally a delay can be set to delay the showing of the entity.
import { VisibilityController } from '@aracna/core';
const controller = new VisibilityController();
(async () => {
await controller.show('dialog');
// will log true
console.log(controller.isVisible('dialog'));
})();The hide method hides an entity. Optionally a delay can be set to delay the hiding of the entity.
import { VisibilityController } from '@aracna/core';
const controller = new VisibilityController();
(async () => {
await controller.show('dialog');
// will log true
console.log(controller.isVisible('dialog'));
await controller.hide('dialog');
// will log true
console.log(controller.isHidden('dialog'));
})();The toggle method toggles the visibility of an entity. Optionally a delay which can be different for showing and hiding can be set to delay the visibility change of the entity.
import { VisibilityController } from '@aracna/core';
const controller = new VisibilityController();
(async () => {
await controller.toggle('dialog');
// will log true
console.log(controller.isVisible('dialog'));
await controller.toggle('dialog');
// will log true
console.log(controller.isHidden('dialog'));
})();