aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src/services/Sidebar.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/src/services/Sidebar.js')
-rw-r--r--apps/files/src/services/Sidebar.js56
1 files changed, 19 insertions, 37 deletions
diff --git a/apps/files/src/services/Sidebar.js b/apps/files/src/services/Sidebar.js
index fee699566bf..0f5c275e532 100644
--- a/apps/files/src/services/Sidebar.js
+++ b/apps/files/src/services/Sidebar.js
@@ -1,39 +1,21 @@
/**
- * @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
- *
- * @author John Molakvoæ <skjnldsv@protonmail.com>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
export default class Sidebar {
- #state;
- #view;
+ _state
constructor() {
// init empty state
- this.#state = {}
+ this._state = {}
// init default values
- this.#state.tabs = []
- this.#state.views = []
- this.#state.file = ''
- this.#state.activeTab = ''
+ this._state.tabs = []
+ this._state.views = []
+ this._state.file = ''
+ this._state.activeTab = ''
console.debug('OCA.Files.Sidebar initialized')
}
@@ -42,23 +24,23 @@ export default class Sidebar {
*
* @readonly
* @memberof Sidebar
- * @returns {Object} the data state
+ * @return {object} the data state
*/
get state() {
- return this.#state
+ return this._state
}
/**
* Register a new tab view
*
* @memberof Sidebar
- * @param {Object} tab a new unregistered tab
- * @returns {Boolean}
+ * @param {object} tab a new unregistered tab
+ * @return {boolean}
*/
registerTab(tab) {
- const hasDuplicate = this.#state.tabs.findIndex(check => check.id === tab.id) > -1
+ const hasDuplicate = this._state.tabs.findIndex(check => check.id === tab.id) > -1
if (!hasDuplicate) {
- this.#state.tabs.push(tab)
+ this._state.tabs.push(tab)
return true
}
console.error(`An tab with the same id ${tab.id} already exists`, tab)
@@ -66,9 +48,9 @@ export default class Sidebar {
}
registerSecondaryView(view) {
- const hasDuplicate = this.#state.views.findIndex(check => check.id === view.id) > -1
+ const hasDuplicate = this._state.views.findIndex(check => check.id === view.id) > -1
if (!hasDuplicate) {
- this.#state.views.push(view)
+ this._state.views.push(view)
return true
}
console.error('A similar view already exists', view)
@@ -79,10 +61,10 @@ export default class Sidebar {
* Return current opened file
*
* @memberof Sidebar
- * @returns {String} the current opened file
+ * @return {string} the current opened file
*/
get file() {
- return this.#state.file
+ return this._state.file
}
/**
@@ -92,7 +74,7 @@ export default class Sidebar {
* @param {string} id the tab unique id
*/
setActiveTab(id) {
- this.#state.activeTab = id
+ this._state.activeTab = id
}
}