Class: PermalinkProvider

PermalinkProvider()

new PermalinkProvider()

The permalink provider. **CAUTION: This class is only usable in applications using the classic toolkit of ExtJS 6.** Sample code displaying a new permalink each time the map is moved:
Source:
Example
preview
    // create permalink provider
    var permalinkProvider = Ext.create('GeoExt.state.PermalinkProvider', {});
    // set it in the state manager
    Ext.state.Manager.setProvider(permalinkProvider);

    // create a map panel, and make it stateful
    var mapComponent = Ext.create('GeoExt.component.Map', {
        stateful: true,
        stateId: 'gx_mapstate',
        map: new ol.Map({
            layers: [
                new ol.layer.Tile({
                    source: new ol.source.OSM()
                })
            ],
            view: new ol.View({
                center: ol.proj.fromLonLat([-8.751278, 40.611368]),
                zoom: 12
            })
        })
    });
    var mapPanel = Ext.create('Ext.panel.Panel', {
        title: 'GeoExt.component.Map Example',
        height: 200,
        items: [mapComponent],
        renderTo: Ext.getBody()
    });
    // display permalink hash each time state is changed
    permalinkProvider.on({
        statechange: function(provider, name, value) {
            alert(provider.getPermalinkHash());
        }
    });

Methods

(static) getPermalinkHash(doRound) → {string}

Returns the URL hash part with current zoom-level, center and rotation corresponding to the current state.
Parameters:
Name Type Description
doRound boolean Flag if coords should be rounded to 2 digits or not
Source:
Returns:
The hash part of the permalink
Type
string

(static) set(name, value)

Sets the value for a key.
Parameters:
Name Type Description
name string The key name
value Object The value to set
Source: