1.1.0 • Published 2 years ago

@polar/plugin-loading-indicator v1.1.0

Weekly downloads
-
License
EUPL-1.2
Repository
github
Last release
2 years ago

LoadingIndicator

Scope

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

Extension ideas

  • More styles (currently not on roadmap)

Store

Mutations

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

Loading indicator example

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.

Getters

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

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

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago