js: add moduleInfo method (#2057)
Add a `ksu.moduleInfo()` in JS. resolves https://github.com/tiann/KernelSU/issues/1571 test module's index.html  The test module: [moduleInfo_test.zip](https://github.com/user-attachments/files/17001977/moduleInfo_test.zip) test module's result: 
This commit is contained in:
@@ -109,3 +109,12 @@ Show a toast message.
|
||||
import { toast } from 'kernelsu';
|
||||
toast('Hello, world!');
|
||||
```
|
||||
|
||||
### moduleInfo
|
||||
|
||||
Get Module info.
|
||||
```javascript
|
||||
import { moduleInfo } from 'kernelsu';
|
||||
// print moduleId in console
|
||||
console.log(moduleInfo());
|
||||
```
|
||||
5
js/index.d.ts
vendored
5
js/index.d.ts
vendored
@@ -37,9 +37,12 @@ declare function fullScreen(isFullScreen: boolean);
|
||||
|
||||
declare function toast(message: string);
|
||||
|
||||
declare function moduleInfo(): string;
|
||||
|
||||
export {
|
||||
exec,
|
||||
spawn,
|
||||
fullScreen,
|
||||
toast
|
||||
toast,
|
||||
moduleInfo
|
||||
}
|
||||
|
||||
@@ -113,3 +113,7 @@ export function fullScreen(isFullScreen) {
|
||||
export function toast(message) {
|
||||
ksu.toast(message);
|
||||
}
|
||||
|
||||
export function moduleInfo() {
|
||||
return ksu.moduleInfo();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "kernelsu",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"description": "Library for KernelSU's module WebUI",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
|
||||
Reference in New Issue
Block a user