Compare commits

..

2 Commits

Author SHA1 Message Date
nyne
a991dac6d6 Update Venera API 2025-09-02 22:17:32 +08:00
Cusox.
c9fdc8367a fix: update index.json (#151) 2025-09-02 22:16:34 +08:00
2 changed files with 54 additions and 19 deletions

View File

@@ -4,6 +4,18 @@ Venera JavaScript Library
This library provides a set of APIs for interacting with the Venera app. This library provides a set of APIs for interacting with the Venera app.
*/ */
/**
* @function sendMessage
* @global
* @param {Object} message
* @returns {any}
*/
/**
* Set a timeout to execute a callback function after a specified delay.
* @param callback {Function}
* @param delay {number} - delay in milliseconds
*/
function setTimeout(callback, delay) { function setTimeout(callback, delay) {
sendMessage({ sendMessage({
method: 'delay', method: 'delay',
@@ -42,8 +54,6 @@ let Convert = {
/** /**
* @param str {string} * @param str {string}
* @returns {ArrayBuffer} * @returns {ArrayBuffer}
*
* @since 1.4.3
*/ */
encodeGbk: (str) => { encodeGbk: (str) => {
return sendMessage({ return sendMessage({
@@ -57,8 +67,6 @@ let Convert = {
/** /**
* @param value {ArrayBuffer} * @param value {ArrayBuffer}
* @returns {string} * @returns {string}
*
* @since 1.4.3
*/ */
decodeGbk: (value) => { decodeGbk: (value) => {
return sendMessage({ return sendMessage({
@@ -1042,20 +1050,6 @@ function ImageLoadingConfig({url, method, data, headers, onResponse, modifyImage
this.onLoadFailed = onLoadFailed; this.onLoadFailed = onLoadFailed;
} }
/**
* @typedef {Object} PageJumpTarget
* @Property {string} page - The page name (search, category)
* @Property {Object} attributes - The attributes of the page
*
* @example
* {
* page: "search",
* attributes: {
* keyword: "example",
* },
* }
*/
class ComicSource { class ComicSource {
name = "" name = ""
@@ -1404,3 +1398,44 @@ let APP = {
}) })
} }
} }
/**
* Set clipboard text
* @param text {string}
* @returns {Promise<void>}
*
* @since 1.3.4
*/
function setClipboard(text) {
return sendMessage({
method: 'setClipboard',
text: text
})
}
/**
* Get clipboard text
* @returns {Promise<string>}
*
* @since 1.3.4
*/
function getClipboard() {
return sendMessage({
method: 'getClipboard'
})
}
/**
* Compute a function with arguments. The function will be executed in the engine pool which is not in the main thread.
* @param func {string} - A js code string which can be evaluated to a function. The function will receive the args as its only argument.
* @param args {any[] | null | undefined} - The arguments to pass to the function.
* @returns {Promise<any>} - The result of the function.
* @since 1.5.0
*/
function compute(func, args) {
return sendMessage({
method: 'compute',
function: func,
args: args
})
}

View File

@@ -114,6 +114,6 @@
"name": "Lanraragi", "name": "Lanraragi",
"fileName": "lanraragi.js", "fileName": "lanraragi.js",
"key": "lanraragi", "key": "lanraragi",
"version": "1.0.0" "version": "1.1.0"
} }
] ]