Skip to content

Commit 3ae6b28

Browse files
authored
fix: replaced inconsistent deprecations (#241)
There is an inconsistent deprecations in ToolsAPI. _getFrameworkInformation. ToolsAPI.js is using the deprecated methods jQuery.sap.debug and jQuery.sap.statistics.
1 parent 9b68620 commit 3ae6b28

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

app/vendor/ToolsAPI.js

+39-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ sap.ui.define(["jquery.sap.global", "sap/ui/core/ElementMetadata"],
33
"use strict";
44

55
var configurationInfo = sap.ui.getCore().getConfiguration();
6+
var BaseConfig = sap.ui.require('sap/base/config/_Configuration');
67

78
// ================================================================================
89
// Technical Information
@@ -54,6 +55,42 @@ sap.ui.define(["jquery.sap.global", "sap/ui/core/ElementMetadata"],
5455
return formattedLibraries;
5556
}
5657

58+
/**
59+
* Returns information whether the framework is in debug mode.
60+
* @returns {boolean}
61+
* @private
62+
*/
63+
64+
function _getDebugModeInfo() {
65+
// check URI param
66+
var vDebugInfo = BaseConfig.get({
67+
name: 'sapUiDebug',
68+
type: BaseConfig.Type.String,
69+
defaultValue: false,
70+
external: true,
71+
freeze: true
72+
});
73+
74+
// check local storage
75+
try {
76+
vDebugInfo = vDebugInfo || window.localStorage.getItem('sap-ui-debug');
77+
} catch (e) {
78+
// access to localStorage might be disallowed
79+
}
80+
81+
// normalize vDebugInfo; afterwards, it either is a boolean or a string not representing a boolean
82+
if ( typeof vDebugInfo === 'string' ) {
83+
if ( /^(?:false|true|x|X)$/.test(vDebugInfo) ) {
84+
vDebugInfo = vDebugInfo !== 'false';
85+
}
86+
} else {
87+
vDebugInfo = !!vDebugInfo;
88+
}
89+
90+
return vDebugInfo;
91+
}
92+
93+
5794
/**
5895
* Gets all the relevant information for the framework.
5996
* @returns {Object}
@@ -71,8 +108,8 @@ sap.ui.define(["jquery.sap.global", "sap/ui/core/ElementMetadata"],
71108
applicationHREF: window.location.href,
72109
documentTitle: document.title,
73110
documentMode: document.documentMode || "",
74-
debugMode: jQuery.sap.debug(),
75-
statistics: jQuery.sap.statistics()
111+
debugMode: _getDebugModeInfo(),
112+
statistics: []
76113
},
77114

78115
configurationBootstrap: window["sap-ui-config"] || Object.create(null),

0 commit comments

Comments
 (0)