v7.3.0

Mask
Widget

Masks a target element (document.body if none is specified). Call static methods for ease of use or make instance for reusability.

 Mask.mask('hello');
 Mask.unmask();

Can show progress:

 // Using progress by calling static method
 const mask = Mask.mask({
     text        :'The task is in progress',
     progress    : 0,
     maxProgress : 100
 });

let timer = setInterval(() => { mask.progress += 5; if (mask.progress >= mask.maxProgress) { Mask.unmask(); clearInterval(timer); } }, 100);

Stacking Multiple Masks

An element can have multiple masks attached to it (for example, to handle independent asynchronous activities). When an element has multiple masks attached, only the first mask created is visible to the user. This avoids unpleasant transparency layering that would occur if all masks were visible at the same time. When the active mask is destroyed or hidden (via hide), the next oldest mask is made visible. That is, masks are displayed in FIFO order.

When a mask is hidden, it is not a candidate in the FIFO order and is ignored when looking for the next oldest mask. If the mask is shown (via show), the mask is again a candidate for being shown, and will be shown immediately if there is not already a currently visible mask. This eliminates flickering effects that would otherwise come from multiple masks competing for display.

When the last mask is hidden or destroyed, the target element becomes unmasked. Showing and hiding of masks is useful when the masks may be needed repeatedly over time.

Masking Bryntum Widgets

Shortcut to masking Bryntum components:

 // Using progress to mask a Bryntum component
 scheduler.mask({
     text:'Loading in progress',
     progress: 0,
     maxProgress: 100
 });

let timer = setInterval(() => { scheduler.masked.progress += 5; if (scheduler.masked.progress >= scheduler.masked.maxProgress) { scheduler.unmask(); clearInterval(timer); } },100);
No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • By default in versions below 8.0, the text is not HTML-encoded. Set this flag to true to automatically HTML-encode the text.

    Has a corresponding runtime htmlEncode property.

  • icon : Stringb-icon b-icon-spinner

    The icon to show next to the text. Defaults to showing a spinner

  • The maximum value of the progress indicator

    Has a corresponding runtime maxProgress property.

  • Number expressing the progress

    Has a corresponding runtime progress property.

  • The number of milliseconds to delay before making the mask visible. If set, the mask will have an initial opacity of 0 but will function in all other ways as a normal mask. Setting this delay can reduce flicker in cases where load operations are typically short (for example, a second or less).

  • The text (or HTML) to show in the mask, the text is not HTML encoded. See also the htmlEncode config for displaying raw HTML. As of v8.0 the text is automatically HTML encoded.

    Has a corresponding runtime text property.

Properties

Properties are getters/setters or publicly accessible variables on this class
  • isMask : Booleantrue
    READONLY
    static
    ADVANCED
    Identifies an object as an instance of Mask class, or subclass thereof.
  • By default in versions below 8.0, the text is not HTML-encoded. Set this flag to true to automatically HTML-encode the text.

    Has a corresponding htmlEncode config.

  • The maximum value of the progress indicator

    Has a corresponding maxProgress config.

  • Number expressing the progress

    Has a corresponding progress config.

  • The text (or HTML) to show in the mask, the text is not HTML encoded. See also the htmlEncode config for displaying raw HTML. As of v8.0 the text is automatically HTML encoded.

    Has a corresponding text config.

  • isMask : Booleantrue
    READONLY
    ADVANCED
    Identifies an object as an instance of Mask class, or subclass thereof.

Functions

Functions are methods available for calling on the class

CSS variables

CSS variables that can be set to adjust appearance
Name Description
--b-mask-background Mask background
--b-mask-border-radius Mask border-radius
--b-mask-color Mask color
--b-mask-padding Mask padding
--b-mask-progress-color Mask progress bar color
--b-mask-progress-height Mask progress bar height
--b-mask-text-background Mask text background
--b-mask-text-color Mask text color

Source path

Core/widget/Mask.js

Contents