Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to call the inbuilt gestures from user scripts #40

Closed
grssam opened this issue Aug 28, 2017 · 2 comments
Closed

Provide a way to call the inbuilt gestures from user scripts #40

grssam opened this issue Aug 28, 2017 · 2 comments

Comments

@grssam
Copy link

grssam commented Aug 28, 2017

I would like to , for instance, be able to have a custom rule based media saving user script, which finally falls back to the default behavior of "save media as" gesture in case my rules did not satisfy.

This is just a simple example, the possibilities are endless.

@marklieberman
Copy link
Owner

You can just invoke the built in commands directly, because they are in-scope of user scripts. The only thing to be aware of is that commands are split into two groups. The user script is running in the unprivileged "content" side in which all commands from "content/commands.js" are in scope. To use commands which require access to privileged APIs such as those in "background/commands.js", do so like the following example:

executeInBackground((data) => {
    commandSaveMediaAs(data);
}, [ data ]);

@grssam
Copy link
Author

grssam commented Aug 28, 2017

Ah, thanks. This should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants