Skip to content
This repository was archived by the owner on Feb 9, 2020. It is now read-only.

Commit a854245

Browse files
committed
v0.10.1
1 parent 97f46bf commit a854245

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

dist/hint.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,13 @@ var AVAILABLE_MODULES = [
479479
];
480480

481481
var SEVERITY_WARNING = 2;
482+
var DEFER_LABEL = 'NG_DEFER_BOOTSTRAP!';
482483

484+
var deferRegex = new RegExp('^' + DEFER_LABEL + '.*');
483485
// Determine whether this run is by protractor.
484486
// If protractor is running, the bootstrap will already be deferred.
485487
// In this case `resumeBootstrap` should be patched to load the hint modules.
486-
if (window.name === 'NG_DEFER_BOOTSTRAP!') {
488+
if (deferRegex.test(window.name)) {
487489
var originalResumeBootstrap;
488490
Object.defineProperty(angular, 'resumeBootstrap', {
489491
get: function() {
@@ -498,10 +500,19 @@ if (window.name === 'NG_DEFER_BOOTSTRAP!') {
498500
}
499501
//If this is not a test, defer bootstrapping
500502
else {
501-
window.name = 'NG_DEFER_BOOTSTRAP!';
503+
window.name = DEFER_LABEL + window.name;
502504

503505
// determine which modules to load and resume bootstrap
504506
document.addEventListener('DOMContentLoaded', maybeBootstrap);
507+
508+
/* angular should remove DEFER_LABEL from window.name, but if angular is never loaded, we want
509+
to remove it ourselves, otherwise hint will incorrectly detect protractor as being present on
510+
the next page load */
511+
window.addEventListener('beforeunload', function() {
512+
if (deferRegex.test(window.name)) {
513+
window.name = window.name.substring(DEFER_LABEL.length);
514+
}
515+
});
505516
}
506517

507518
function maybeBootstrap() {
@@ -1835,7 +1846,7 @@ function decorateRootScope($delegate, $parse) {
18351846
value: value
18361847
};
18371848
hint.emit('model:change', {
1838-
id: scopeId,
1849+
id: convertIdToOriginalType(scopeId),
18391850
path: partialPath,
18401851
value: value
18411852
});
@@ -2042,7 +2053,7 @@ function decorateRootScope($delegate, $parse) {
20422053
var value = summarize(model.get());
20432054
if (value !== model.value) {
20442055
hint.emit('model:change', {
2045-
id: (angular.version.minor < 3) ? scopeId : parseInt(scopeId),
2056+
id: convertIdToOriginalType(scopeId),
20462057
path: path,
20472058
oldValue: model.value,
20482059
value: value
@@ -2133,4 +2144,8 @@ function isOneTimeBindExp(exp) {
21332144
return exp.charAt(0) === ':' && exp.charAt(1) === ':';
21342145
}
21352146

2147+
function convertIdToOriginalType(scopeId) {
2148+
return (angular.version.minor < 3) ? scopeId : parseInt(scopeId, 10);
2149+
}
2150+
21362151
},{"../lib/summarize-model":9,"debounce-on":4}]},{},[1]);

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "AngularJS Batarang",
3-
"version": "0.10.0",
3+
"version": "0.10.1",
44
"description": "Extends the Developer Tools, adding tools for debugging and profiling AngularJS applications.",
55
"devtools_page": "devtoolsBackground.html",
66
"manifest_version": 2,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angularjs-batarang",
3-
"version": "0.10.0",
3+
"version": "0.10.1",
44
"description": "chrome extension for inspecting angular apps",
55
"main": "hint.js",
66
"devDependencies": {

0 commit comments

Comments
 (0)