summaryrefslogtreecommitdiffstats
path: root/core/src/globals.js
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/globals.js')
-rw-r--r--core/src/globals.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/core/src/globals.js b/core/src/globals.js
index 7d201ec5b0b..cbb26cfc2a8 100644
--- a/core/src/globals.js
+++ b/core/src/globals.js
@@ -20,7 +20,7 @@
*/
/**
- *
+ *
* @param {Function} func the library to deprecate
* @param {String} funcName the name of the library
*/
@@ -34,6 +34,18 @@ const deprecate = (func, funcName) => {
return newFunc
}
+const setDeprecatedProp = (global, val, msg) =>
+ Object.defineProperty(window, global, {
+ get: () => {
+ if (msg) {
+ console.warn(`${global} is deprecated: ${msg}`)
+ } else {
+ console.warn(`${global} is deprecated`)
+ }
+ return val
+ }
+ })
+
import _ from 'underscore'
import $ from 'jquery'
import 'jquery-migrate/dist/jquery-migrate.min'
@@ -91,6 +103,7 @@ window['md5'] = md5
window['moment'] = moment
window['OC'] = OC
+setDeprecatedProp('OCDialogs', OC.dialogs, 'use OC.dialogs')
window['OCP'] = OCP
window['OCA'] = OCA
window['escapeHTML'] = deprecate(escapeHTML, 'escapeHTML')