mirror of
https://github.com/nextcloud/documentation.git
synced 2026-01-02 17:59:36 +07:00
Adds an example how to emi files:node:* events
Signed-off-by: Cyrille Bollu <StCyr@users.noreply.github.com>
This commit is contained in:
committed by
Ferdinand Thiessen
parent
9fb405f5b7
commit
2a6d7ea96d
@@ -30,7 +30,9 @@ the ``event-bus`` and use the following events:
|
||||
* ``files:node:moved``: the node has been moved (and its data is already updated)
|
||||
* ``files:node:updated``: the node data has been updated
|
||||
|
||||
Example
|
||||
All these events use a Node as argument.
|
||||
|
||||
Examples
|
||||
-------
|
||||
|
||||
.. code-block:: ts
|
||||
@@ -42,6 +44,20 @@ Example
|
||||
console.log('Node created', node)
|
||||
})
|
||||
|
||||
.. code-block:: ts
|
||||
|
||||
import { davGetClient, davGetDefaultPropfind, davResultToNode, davRootPath } from '@nextcloud/files'
|
||||
import { emit } from '@nextcloud/event-bus'
|
||||
|
||||
const client = davGetClient()
|
||||
client.stat(`${davRootPath}${filename}`, {
|
||||
details: true,
|
||||
data: davGetDefaultPropfind(),
|
||||
}).then((result) => {
|
||||
const node = davResultToNode(result.data)
|
||||
emit('files:node:updated', node)
|
||||
})
|
||||
|
||||
|
||||
Router
|
||||
^^^^^^
|
||||
|
||||
Reference in New Issue
Block a user