1 | declare module '@ember/routing/none-location' {
|
2 | import EmberObject from '@ember/object';
|
3 | import type { default as EmberLocation, UpdateCallback } from '@ember/routing/location';
|
4 | /**
|
5 | @module @ember/routing/none-location
|
6 | */
|
7 | /**
|
8 | NoneLocation does not interact with the browser. It is useful for
|
9 | testing, or when you need to manage state with your Router, but temporarily
|
10 | don't want it to muck with the URL (for example when you embed your
|
11 | application in a larger page).
|
12 |
|
13 | Using `NoneLocation` causes Ember to not store the applications URL state
|
14 | in the actual URL. This is generally used for testing purposes, and is one
|
15 | of the changes made when calling `App.setupForTesting()`.
|
16 |
|
17 | @class NoneLocation
|
18 | @extends EmberObject
|
19 | @protected
|
20 | */
|
21 | export default class NoneLocation extends EmberObject implements EmberLocation {
|
22 | updateCallback?: UpdateCallback;
|
23 | path: string;
|
24 | /**
|
25 | Will be pre-pended to path.
|
26 |
|
27 | @private
|
28 | @property rootURL
|
29 | @default '/'
|
30 | */
|
31 | rootURL: string;
|
32 | initState(): void;
|
33 | /**
|
34 | Returns the current path without `rootURL`.
|
35 |
|
36 | @private
|
37 | @method getURL
|
38 | @return {String} path
|
39 | */
|
40 | getURL(): string;
|
41 | /**
|
42 | Set the path and remembers what was set. Using this method
|
43 | to change the path will not invoke the `updateURL` callback.
|
44 |
|
45 | @private
|
46 | @method setURL
|
47 | @param path {String}
|
48 | */
|
49 | setURL(path: string): void;
|
50 | /**
|
51 | Register a callback to be invoked when the path changes. These
|
52 | callbacks will execute when the user presses the back or forward
|
53 | button, but not after `setURL` is invoked.
|
54 |
|
55 | @private
|
56 | @method onUpdateURL
|
57 | @param callback {Function}
|
58 | */
|
59 | onUpdateURL(callback: (url: string) => void): void;
|
60 | /**
|
61 | Sets the path and calls the `updateURL` callback.
|
62 |
|
63 | @private
|
64 | @method handleURL
|
65 | @param url {String}
|
66 | */
|
67 | handleURL(url: string): void;
|
68 | /**
|
69 | Given a URL, formats it to be placed into the page as part
|
70 | of an element's `href` attribute.
|
71 |
|
72 | @private
|
73 | @method formatURL
|
74 | @param {String} url
|
75 | @return {String} url
|
76 | */
|
77 | formatURL(url: string): string;
|
78 | }
|
79 | }
|