EN RU
Форум

Методология

Технологии

Инструментарий

Библиотеки

Учебные материалы

DocumentationJSDocExamplesSource

location

Высокоуровневый блок для изменения window.location.

Использование

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

    // Изменяем `window.location` с помощью полного url
    location.change({ url: 'http://example.org:8080/path' });

    // Изменяем текущий location, используя только новые параметры запроса
    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