summaryrefslogtreecommitdiffstats
path: root/core/src/globals.js
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-03-14 22:34:35 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2019-03-15 16:40:08 +0100
commitb4dd12e50ce643c63ced0f7d1d224ddfc7e50945 (patch)
tree36fd68ca749ffe934d6f84162a474360e4c7995b /core/src/globals.js
parentc01019b5368d786e0603fc20ac240306a74ae9cb (diff)
downloadnextcloud-server-b4dd12e50ce643c63ced0f7d1d224ddfc7e50945.tar.gz
nextcloud-server-b4dd12e50ce643c63ced0f7d1d224ddfc7e50945.zip
Deprecate marked, escapeHTML, formatDate, getURLParameter, humanFileSize, relative_modified_date and select2
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'core/src/globals.js')
-rw-r--r--core/src/globals.js34
1 files changed, 25 insertions, 9 deletions
diff --git a/core/src/globals.js b/core/src/globals.js
index e7704ccff03..7d201ec5b0b 100644
--- a/core/src/globals.js
+++ b/core/src/globals.js
@@ -1,7 +1,7 @@
-/*
- * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
- * @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @license GNU AGPL version 3 or any later version
*
@@ -19,6 +19,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ *
+ * @param {Function} func the library to deprecate
+ * @param {String} funcName the name of the library
+ */
+const deprecate = (func, funcName) => {
+ const oldFunc = func
+ const newFunc = function() {
+ console.warn(`The ${funcName} library is deprecated! It will be removed in nextcloud 19.`)
+ return oldFunc.apply(this, arguments)
+ }
+ Object.assign(newFunc, oldFunc)
+ return newFunc
+}
+
import _ from 'underscore'
import $ from 'jquery'
import 'jquery-migrate/dist/jquery-migrate.min'
@@ -71,18 +86,19 @@ window['Handlebars'] = Handlebars
window['jstimezonedetect'] = jstimezonedetect
window['jstz'] = jstimezonedetect
window['jQuery'] = $
-window['marked'] = marked
+window['marked'] = deprecate(marked, 'marked')
window['md5'] = md5
window['moment'] = moment
window['OC'] = OC
window['OCP'] = OCP
window['OCA'] = OCA
-window['escapeHTML'] = escapeHTML
-window['formatDate'] = formatDate
-window['getURLParameter'] = getURLParameter
-window['humanFileSize'] = humanFileSize
-window['relative_modified_date'] = relative_modified_date
+window['escapeHTML'] = deprecate(escapeHTML, 'escapeHTML')
+window['formatDate'] = deprecate(formatDate, 'formatDate')
+window['getURLParameter'] = deprecate(getURLParameter, 'getURLParameter')
+window['humanFileSize'] = deprecate(humanFileSize, 'humanFileSize')
+window['relative_modified_date'] = deprecate(relative_modified_date, 'relative_modified_date')
+$.fn.select2 = deprecate($.fn.select2, 'select2')
/**
* translate a string