1.2.1 • Published 9 months ago

@polar/plugin-loading-indicator v1.2.1

Weekly downloads
-
License
EUPL-1.2
Repository
github
Last release
9 months ago

LoadingIndicator

Scope

A generic loading indicator that may be used by any plugin or outside procedure to indicate loading.

Configuration

loadingIndicator

fieldNametypedescription
loaderStyleenum'CircleLoader', 'BasicLoader', 'none', 'RingLoader', 'RollerLoader', 'SpinnerLoader', 'v-progress-linear'?Choose between different loader styles. Defaults to 'v-progress-linear' (Vuetify loader).

For details on the displayComponent attribute, refer to the Global Plugin Parameters section of @polar/core.

Example configuration:

loadingIndicator: {
  loaderStyle: 'RollerLoader',
}

Store

Mutations

// show loading indicator
map.$store.commit('plugin/loadingIndicator/addLoadingKey', key)
// hide loading indicator
map.$store.commit('plugin/loadingIndicator/removeLoadingKey', key)

The key must be unique and is kept track of via a Set. It can't be added multiple times, and removing it once always removes it altogether. It is advised to use a key like {my-plugin-or-application-name}-{procedure-name} to avoid name conflicts. The LoadingIndicator will usually be used for asynchronous code.

As such, always call removeLoadingKey in the finally section of your code to prevent hanging loading indicators.

// change loader style at runtime
map.$store.commit('plugin/loadingIndicator/setLoaderStyle', loaderStyle)

Supported loaderStyle options

It is also possible to choose none as a loaderStyle to hide the loader.

Getters

You may desire to listen to whether the loader is currently being shown.

fieldNametypedescription
loaderStylestringThe current loader style.
showLoaderbooleanWhether the layer is currently shown.
mapInstance.$store.watch(
    (_, getters) => getters['plugin/loadingIndicator/showLoader'],
    (showLoader) => {
        /* This code is called on showLoader updates. */
    }
)
1.2.0

11 months ago

1.2.1

9 months ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago