Skip to content

Cache Button

Provided by: @geoleaf-plugins/storage (commercial plugin) Requires: @geoleaf-plugins/storage loaded and registered


Description

The Cache Button is a MapLibre GL JS control injected by the @geoleaf-plugins/storage plugin when the option showCacheButton is enabled. It provides an offline cache management UI accessible from the map interface.

This component is part of the Storage plugin and is not included in @geoleaf/core. The core only detects its presence and delegates initialization to the plugin.


Configuration

Enable or disable the button in your GeoLeaf profile:

jsonc
{
    "ui": {
        "showCacheButton": true, // default: true when Storage plugin is loaded
    },
}

Public API

When the Storage plugin is loaded, the following methods are available:

js
// Initialized automatically at boot (if showCacheButton: true)
GeoLeaf.UI.CacheButton.init(map, cfg);

// Open the cache management modal programmatically
GeoLeaf.UI.CacheButton.openModal();

// Close the modal
GeoLeaf.UI.CacheButton.closeModal();

Accessibility

  • Keyboard shortcut: Escape closes the modal
  • ARIA attributes on the control button
  • Color contrast compliant

Full Documentation

The complete API and implementation details are documented in the Storage plugin's own documentation, delivered with the commercial license.

See also: FAQ — Installing commercial plugins

Released under the MIT License.