mirror of
https://github.com/venera-app/venera-configs.git
synced 2025-09-27 00:27:23 +00:00
Update api
This commit is contained in:
@@ -745,6 +745,12 @@ class NewComicSource extends ComicSource {
|
||||
title: "Setting4",
|
||||
type: "callback",
|
||||
buttonText: "Click me",
|
||||
/**
|
||||
* callback function
|
||||
*
|
||||
* If the callback function returns a Promise, the button will show a loading indicator until the promise is resolved.
|
||||
* @returns {void | Promise<any>}
|
||||
*/
|
||||
callback: () => {
|
||||
// do something
|
||||
}
|
||||
|
53
_venera_.js
53
_venera_.js
@@ -4,6 +4,13 @@ Venera JavaScript Library
|
||||
This library provides a set of APIs for interacting with the Venera app.
|
||||
*/
|
||||
|
||||
function setTimeout(callback, delay) {
|
||||
sendMessage({
|
||||
method: 'delay',
|
||||
time: delay,
|
||||
}).then(callback);
|
||||
}
|
||||
|
||||
/// encode, decode, hash, decrypt
|
||||
let Convert = {
|
||||
/**
|
||||
@@ -1197,3 +1204,49 @@ class Image {
|
||||
return new Image(key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UI related apis
|
||||
* @since 1.2.0
|
||||
*/
|
||||
let UI = {
|
||||
/**
|
||||
* Show a message
|
||||
* @param message {string}
|
||||
*/
|
||||
showMessage: (message) => {
|
||||
sendMessage({
|
||||
method: 'UI',
|
||||
function: 'showMessage',
|
||||
message: message,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* Show a dialog. Any action will close the dialog.
|
||||
* @param title {string}
|
||||
* @param content {string}
|
||||
* @param actions {{text:string, callback: () => void}[]}
|
||||
*/
|
||||
showDialog: (title, content, actions) => {
|
||||
sendMessage({
|
||||
method: 'UI',
|
||||
function: 'showDialog',
|
||||
title: title,
|
||||
content: content,
|
||||
actions: actions,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* Open [url] in external browser
|
||||
* @param url {string}
|
||||
*/
|
||||
launchUrl: (url) => {
|
||||
sendMessage({
|
||||
method: 'UI',
|
||||
function: 'launchUrl',
|
||||
url: url,
|
||||
})
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user