aboutsummaryrefslogtreecommitdiffstats
path: root/core/src/globals.js
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-02-10 09:12:58 +0100
committernpmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>2020-02-11 07:39:10 +0000
commit328f9673b5bb17238091dd57b8229ef8d185597a (patch)
tree9b431192e9a403c7ef41a2308ce939777e397724 /core/src/globals.js
parentdb5ffc6d94703f49df8f5ba13670ad7544cf0bc0 (diff)
downloadnextcloud-server-328f9673b5bb17238091dd57b8229ef8d185597a.tar.gz
nextcloud-server-328f9673b5bb17238091dd57b8229ef8d185597a.zip
Deprecate jQuery
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at> Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
Diffstat (limited to 'core/src/globals.js')
-rw-r--r--core/src/globals.js35
1 files changed, 17 insertions, 18 deletions
diff --git a/core/src/globals.js b/core/src/globals.js
index e6930cd3dbc..89f8524a0c9 100644
--- a/core/src/globals.js
+++ b/core/src/globals.js
@@ -87,34 +87,33 @@ const deprecate = (func, funcName, version) => {
}
const setDeprecatedProp = (global, cb, msg) => {
- if (window[global] !== undefined) {
- delete window[global]
- }
- Object.defineProperty(window, global, {
- get: () => {
- if (msg) {
- warnIfNotTesting(`${global} is deprecated: ${msg}`)
- } else {
- warnIfNotTesting(`${global} is deprecated`)
- }
+ (Array.isArray(global) ? global : [global]).map(global => {
+ if (window[global] !== undefined) {
+ delete window[global]
+ }
+ Object.defineProperty(window, global, {
+ get: () => {
+ if (msg) {
+ warnIfNotTesting(`${global} is deprecated: ${msg}`)
+ } else {
+ warnIfNotTesting(`${global} is deprecated`)
+ }
- return cb()
- },
+ return cb()
+ },
+ })
})
}
window['_'] = _
-window['$'] = $
+setDeprecatedProp(['$', 'jQuery'], () => $, 'The global jQuery is deprecated. It will be updated to v2.4 in Nextcloud 20 and v3.x in Nextcloud 21. In later versions of Nextcloud it might be removed completely. Please ship your own.')
setDeprecatedProp('autosize', () => autosize, 'please ship your own, this will be removed in Nextcloud 20')
setDeprecatedProp('Backbone', () => Backbone, 'please ship your own, this will be removed in Nextcloud 20')
-setDeprecatedProp('Clipboard', () => ClipboardJS, 'please ship your own, this will be removed in Nextcloud 20')
-setDeprecatedProp('ClipboardJS', () => ClipboardJS, 'please ship your own, this will be removed in Nextcloud 20')
+setDeprecatedProp(['Clipboard', 'ClipboardJS'], () => ClipboardJS, 'please ship your own, this will be removed in Nextcloud 20')
window['dav'] = dav
setDeprecatedProp('DOMPurify', () => DOMPurify, 'The global DOMPurify is deprecated, ship your own')
setDeprecatedProp('Handlebars', () => Handlebars, 'please ship your own, this will be removed in Nextcloud 20')
-setDeprecatedProp('jstimezonedetect', () => jstimezonedetect, 'please ship your own, this will be removed in Nextcloud 20')
-setDeprecatedProp('jstz', () => jstimezonedetect, 'please ship your own, this will be removed in Nextcloud 20')
-window['jQuery'] = $
+setDeprecatedProp(['jstz', 'jstimezonedetect'], () => jstimezonedetect, 'please ship your own, this will be removed in Nextcloud 20')
window['marked'] = deprecate(marked, 'marked', 19)
setDeprecatedProp('md5', () => md5, 'please ship your own, this will be removed in Nextcloud 20')
setDeprecatedProp('moment', () => moment, 'please ship your own, this will be removed in Nextcloud 20')