Skip to main content

open-file

Description

Fires when opening a file

The action is triggered with a double-click on a file but you need to add the event handler to process the action (e.g., use the api.on() method) so that a file gets opened.

Usage

"open-file": ({
id: string
})

Parameters

The callback of the open-file action takes an object with the following parameters:

  • id - (required) the ID of a file

Example

<script>
import { getData, getDrive } from "./common/data";
import { Filemanager } from "@wx/svelte-filemanager";

let api;

$: if (api) {
api.on("open-file", ({ id }) => {
console.log(`File ${id} is double-clicked`);
});
}

</script>

<Filemanager data={getData()} drive={getDrive()} bind:api />

Related articles: How to access File Manager API