EN RU
Forum

Methodology

Technology

Toolbox

Libraries

Tutorials

DocumentationJSDocExamplesSource

location

High-level module for a window.location change.

Usage

modules.require(['location'], function(location) {

    // Change `window.location` using a full url
    location.change({ url: 'http://example.org:8080/path' });

    // Change current location using only the new query params
    location.change({ params: { param1: [11,12], param2: 'ololo' } });
    window.location.href; // "http://example.org:8080/path?param1=11&param1=12&param2=ololo"

});

Module location

Augments:events:Emitter

Instance methods:

change(data, data.params, data.url, [data.silen], data.forceParams, data.replace)
description
Method for a location change. It's possible to change location by an exact url or a query params (params can be overwritten using the forceParams flag). Method work depends on the provided data.
parameters
data
Object
data.params
Object
query params
data.url
String
new url
data.silen
Boolean
= false] do not trigger change event
data.forceParams
Boolean
flag to overwrite current params with new. By default new params are extended with old
data.replace
Boolean
write history record or replace current
getState():Object
description
Returns current state.
getUri():uri
description
Returns an Uri instance constructed from the current state url.
getReferer():String
description
Returns previous url.
Open in a new window
Open in a new window