mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-23 19:40:56 +08:00
$location service should utilize onhashchange events instead of polling
This commit is contained in:
15
test/angular-mocks.js
vendored
15
test/angular-mocks.js
vendored
@@ -63,8 +63,23 @@ function MockBrowser() {
|
||||
|
||||
this.isMock = true;
|
||||
self.url = "http://server";
|
||||
self.lastUrl = self.url; // used by url polling fn
|
||||
self.pollFns = [];
|
||||
|
||||
|
||||
// register url polling fn
|
||||
|
||||
self.onHashChange = function(listener) {
|
||||
self.pollFns.push(
|
||||
function() {
|
||||
if (self.lastUrl != self.url) {
|
||||
listener();
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
self.xhr = function(method, url, data, callback) {
|
||||
if (angular.isFunction(data)) {
|
||||
callback = data;
|
||||
|
||||
Reference in New Issue
Block a user