blob: fe5130fbb49ff4557b39c9a2bedca5238968282b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/**
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
export default class ExternalLinkActions {
_state
constructor() {
// init empty state
this._state = {}
// init default values
this._state.actions = []
console.debug('OCA.Sharing.ExternalLinkActions initialized')
}
/**
* Get the state
*
* @readonly
* @memberof ExternalLinkActions
* @return {object} the data state
*/
get state() {
return this._state
}
/**
* Register a new action for the link share
* Mostly used by the social sharing app.
*
* @param {object} action new action component to register
* @return {boolean}
*/
registerAction(action) {
OC.debug && console.warn('OCA.Sharing.ExternalLinkActions is deprecated, use OCA.Sharing.ExternalShareAction instead')
if (typeof action === 'object' && action.icon && action.name && action.url) {
this._state.actions.push(action)
return true
}
console.error('Invalid action provided', action)
return false
}
}
|