-
Notifications
You must be signed in to change notification settings - Fork 32
/
file-browser-handler.go
37 lines (28 loc) · 1.11 KB
/
file-browser-handler.go
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
// WARNING: FileBrowserHandler only works on Chrome OS
package chrome
import "github.com/gopherjs/gopherjs/js"
type FileBrowserHandler struct {
o *js.Object
}
/*
* Types
*/
type FileHandlerExecuteEventDetails struct {
*js.Object
Entries []interface{} `js:"entries"`
Tab_id int `js:"tab_id"`
}
/*
* Methods:
*/
/* SelectFile prompts user to select file path under which file should be saved. When the file is selected, file access permission required to use the file (read, write and create) are granted to the caller. The file will not actually get created during the function call, so function caller must ensure its existence before using it. The function has to be invoked with a user gesture. */
func (f *FileBrowserHandler) SelectFile(selectionParams Object, callback func(result Object)) {
f.o.Call("selectFile", selectionParams, callback)
}
/*
* Events
*/
// OnExecute fired when file system action is executed from ChromeOS file browser.
func (f *FileBrowserHandler) OnExecute(callback func(id string, details FileHandlerExecuteEventDetails)) {
f.o.Get("onExecute").Call("addListener", callback)
}