@angular-wave/angular.ts 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,136 +9,73 @@ export function trimEmptyHash(url: string): string;
9
9
  * @typedef {function(string, string|null): any} UrlChangeListener
10
10
  */
11
11
  /**
12
- * @name $browser
13
- * @description
14
12
  * This object has two goals:
15
13
  *
16
14
  * - hide all the global state in the browser caused by the window object
17
15
  * - abstract away all the browser specific features and inconsistencies
18
- *
19
- *
20
- */
21
- /**
22
- * @param {import('../core/task-tracker-factory').TaskTracker} taskTracker
23
16
  */
24
- export function Browser(taskTracker: import("../core/task-tracker-factory").TaskTracker): void;
25
17
  export class Browser {
26
- /**
27
- * @typedef {function(string, string|null): any} UrlChangeListener
28
- */
29
- /**
30
- * @name $browser
31
- * @description
32
- * This object has two goals:
33
- *
34
- * - hide all the global state in the browser caused by the window object
35
- * - abstract away all the browser specific features and inconsistencies
36
- *
37
- *
38
- */
39
18
  /**
40
19
  * @param {import('../core/task-tracker-factory').TaskTracker} taskTracker
41
20
  */
42
21
  constructor(taskTracker: import("../core/task-tracker-factory").TaskTracker);
43
- $$completeOutstandingRequest: (fn: any, taskType: any) => void;
44
- $$incOutstandingRequestCount: (taskType: any) => void;
45
- notifyWhenNoOutstandingRequests: (callback: any, taskType: any) => void;
46
22
  /**
47
- * @name $browser#url
48
- *
49
- * @description
50
- * GETTER:
51
- * Without any argument, this method just returns current value of `location.href` (with a
52
- * trailing `#` stripped of if the hash is empty).
53
- *
54
- * SETTER:
55
- * With at least one argument, this method sets url to new value.
56
- * If html5 history api supported, `pushState`/`replaceState` is used, otherwise
57
- * `location.href`/`location.replace` is used.
58
- * Returns its own instance to allow chaining.
59
- *
60
- * NOTE: this api is intended for use only by the `$location` service. Please use the
61
- * {@link ng.$location $location service} to change url.
62
- *
63
- * @param {string=} url New url (when used as setter)
64
- * @param {boolean=} replace Should new url replace current history record?
65
- * @param {object=} state State object to use with `pushState`/`replaceState`
23
+ * @type {import('../core/task-tracker-factory').TaskTracker} taskTracker
66
24
  */
67
- url: (url?: string | undefined, replace?: boolean | undefined, state?: object | undefined) => string | this;
25
+ taskTracker: import("../core/task-tracker-factory").TaskTracker;
26
+ pendingDeferIds: {};
27
+ /** @type {Array<UrlChangeListener>} */
28
+ urlChangeListeners: Array<UrlChangeListener>;
29
+ urlChangeInit: boolean;
30
+ /** @type {any} */
31
+ cachedState: any;
32
+ /** @type {any} */
33
+ lastHistoryState: any;
34
+ /** @type {string} */
35
+ lastBrowserUrl: string;
36
+ /** @type {JQLite} */
37
+ baseElement: JQLite;
38
+ $$completeOutstandingRequest: any;
39
+ $$incOutstandingRequestCount: any;
40
+ notifyWhenNoOutstandingRequests: any;
41
+ url(url: any, state: any): string | this;
68
42
  /**
69
- * @name $browser#state
43
+ * Returns the cached state.
70
44
  *
71
- * @description
72
- * This method is a getter.
73
- *
74
- * Return history.state or null if history.state is undefined.
75
- *
76
- * @returns {object} state
77
- */
78
- state: () => object;
79
- /**
80
- * Register callback function that will be called, when url changes.
81
- *
82
- * It's only called when the url is changed from outside of AngularJS:
83
- * - user types different url into address bar
84
- * - user clicks on history (forward/back) button
85
- * - user clicks on a link
86
- *
87
- * It's not called when url is changed by $browser.url() method
88
- *
89
- * The listener gets called with new url as parameter.
90
- *
91
- * NOTE: this api is intended for use only by the $location service. Please use the
92
- * {@link ng.$location $location service} to monitor url changes in AngularJS apps.
93
- *
94
- * @param {UrlChangeListener} callback Listener function to be called when url changes.
95
- * @return {UrlChangeListener} Returns the registered listener fn - handy if the fn is anonymous.
45
+ * @returns {any} The cached state.
96
46
  */
97
- onUrlChange: (callback: UrlChangeListener) => UrlChangeListener;
47
+ state(): any;
98
48
  /**
99
- * Remove popstate and hashchange handler from window.
49
+ * Caches the current state and fires the URL change event.
100
50
  *
101
- * NOTE: this api is intended for use only by $rootScope.
102
- */
103
- $$applicationDestroyed: () => void;
104
- /**
105
- * Checks whether the url has changed outside of AngularJS.
106
- * Needs to be exported to be able to check for changes that have been done in sync,
107
- * as hashchange/popstate events fire in async.
51
+ * @private
108
52
  */
109
- $$checkUrlChange: () => void;
53
+ private cacheStateAndFireUrlChange;
110
54
  /**
111
- * Returns current <base href>
112
- * (always relative - without domain)
55
+ * Caches the current state.
113
56
  *
114
- * @returns {string} The current base href
57
+ * @private
115
58
  */
116
- baseHref: () => string;
59
+ private cacheState;
60
+ lastCachedState: any;
117
61
  /**
118
- * @param {function():any} fn A function, who's execution should be deferred.
119
- * @param {number=} [delay=0] Number of milliseconds to defer the function execution.
120
- * @param {string=} [taskType=DEFAULT_TASK_TYPE] The type of task that is deferred.
121
- * @returns {number} DeferId that can be used to cancel the task via `$browser.cancel()`.
122
- *
123
- * Executes a fn asynchronously via `setTimeout(fn, delay)`.
124
- *
125
- * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using
126
- * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed
127
- * via `$browser.defer.flush()`.
62
+ * Fires the state or URL change event.
128
63
  *
64
+ * @private
129
65
  */
130
- defer: (fn: () => any, delay?: number | undefined, taskType?: string | undefined) => number;
66
+ private fireStateOrUrlChange;
131
67
  /**
132
- * @name $browser#cancel
133
- *
134
- * @description
135
- * Cancels a deferred task identified with `deferId`.
68
+ * Registers a callback to be called when the URL changes.
136
69
  *
137
- * @param {number} deferId Token returned by the `$browser.defer` function.
138
- * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
139
- * canceled.
70
+ * @param {UrlChangeListener} callback - The callback function to register.
71
+ * @returns {UrlChangeListener} The registered callback function.
140
72
  */
141
- cancel: (deferId: number) => boolean;
73
+ onUrlChange(callback: UrlChangeListener): UrlChangeListener;
74
+ $$applicationDestroyed(): void;
75
+ $$checkUrlChange(): void;
76
+ baseHref(): any;
77
+ defer(fn: any, delay?: number, taskType?: string): number;
78
+ cancel(deferId: any): boolean;
142
79
  }
143
80
  /**
144
81
  * This object has two goals:
@@ -152,3 +89,4 @@ export class BrowserProvider {
152
89
  $get: (string | (($$taskTrackerFactory: import("../core/task-tracker-factory").TaskTracker) => Browser))[];
153
90
  }
154
91
  export type UrlChangeListener = (arg0: string, arg1: string | null) => any;
92
+ import { JQLite } from "../shared/jqlite/jqlite";
@@ -12,7 +12,6 @@ export class $HttpBackendProvider {
12
12
  }
13
13
  /**
14
14
  * @param {import('../browser').Browser} $browser
15
- * @param {*} $browserDefer
16
15
  * @returns
17
16
  */
18
- export function createHttpBackend($browser: import("../browser").Browser, $browserDefer: any): (method: any, url: any, post: any, callback: any, headers: any, timeout: any, withCredentials: any, responseType: any, eventHandlers: any, uploadEventHandlers: any) => void;
17
+ export function createHttpBackend($browser: import("../browser").Browser): (method: any, url: any, post: any, callback: any, headers: any, timeout: any, withCredentials: any, responseType: any, eventHandlers: any, uploadEventHandlers: any) => void;
@@ -1,3 +1,4 @@
1
+ export function isNullOrUndefined(obj: any): boolean;
1
2
  /**
2
3
  * Predicate which checks if a value is injectable
3
4
  *
@@ -16,4 +17,3 @@ export function isInjectable(val: any): boolean;
16
17
  */
17
18
  export function isPromise(obj: any): boolean;
18
19
  export function isNull(o: any): boolean;
19
- export const isNullOrUndefined: (...args: any[]) => any;