HashLocation

Ember.HashLocation Class

PRIVATE

Extends: Ember.Object

Defined in: packages/ember-routing/lib/location/hash_location.js:15

Module: ember-routing

Ember.HashLocation implements the location API using the browser's hash. At present, it relies on a hashchange event existing in the browser.

formatURL (url) private

Defined in packages/ember-routing/lib/location/hash_location.js:127

Given a URL, formats it to be placed into the page as part of an element's href attribute.

This is used, for example, when using the {{action}} helper to generate a URL based on an event.

Parameters:

url String

getHashprivate

Defined in packages/ember-routing/lib/location/hash_location.js:34
Available since 1.5.1

getURLprivate

Defined in packages/ember-routing/lib/location/hash_location.js:44

Returns the normalized URL, constructed from location.hash.

e.g. #/foo => /foo as well as #/foo#bar => /foo#bar.

By convention, hashed paths must begin with a forward slash, otherwise they are not treated as a path so we can distinguish intent.

onUpdateURL (callback) private

Defined in packages/ember-routing/lib/location/hash_location.js:101

Register a callback to be invoked when the hash changes. These callbacks will execute when the user presses the back or forward button, but not after setURL is invoked.

Parameters:

callback Function

replaceURL (path) private

Defined in packages/ember-routing/lib/location/hash_location.js:88

Uses location.replace to update the url without a page reload or history modification.

Parameters:

path String

setURL (path) private

Defined in packages/ember-routing/lib/location/hash_location.js:74

Set the location.hash and remembers what was set. This prevents onUpdateURL callbacks from triggering when the hash was set by HashLocation.

Parameters:

path String

willDestroyprivate

Inherited from Ember.CoreObject but overwritten in packages/ember-routing/lib/location/hash_location.js:142

Cleans up the HashLocation event listener.

© 2017 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://emberjs.com/api/classes/Ember.HashLocation.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部