Skip to content

Latest commit

 

History

History
89 lines (84 loc) · 7.81 KB

runtimes_and_apis.md

File metadata and controls

89 lines (84 loc) · 7.81 KB

Daijishou JavaScript Runtimes and APIs

Environments

Daijishou uses Javet library to enable JavaScript features. Javet provides Node.js V8 environment, it implements ECMAScript and WebAssembly.

Therefore, Daijishou Node.js V8 Runtime, which is built upon those technologies, is a superset of Node.js V8 includes additional APIs and permission controls. Which means that, in general cases, Daijishou V8 Runtime inherits the ECMAScript language features.

Environment JavaScript Technology Abbreviation Notes
Daijishou Extension Manger V8 Runtime V8 by Javet Node.js V8 No permission control, less security. For debug purpose, can only be executed by user or Daijishou SDK.
Daijishou Extension V8 Runtime V8 by Javet Extension --
WebView WebView on Android WebView No API access, except basic communication with extension modules.

Permissions

Permission Notes
all This wil enable every permissions. Very dangerous, please be responsible.
debug Enable debug features. Very dangerous, please be responsible.
system Allow the extension to get system and identification info of Daijishou.
library Allow access to Daijishou library that manage items and media.
retro_achievements Enable daijishou Retro Achievements APIs.
files Enable direct file access.
internet Enable APIs that related to internet.
interactions Enable ability to toast messages and show dialogs.
export_modules Allow the extension to expose and export V8 JavaScript modules.

APIs

Global Objects

Object Type isProxy References Required permissions Notes
Common (Extension & V8)
locale String -- -- For example en-US, zh-TW.
lifecycleOwner Object ✔️ Android lifecycle -- --
lifecycleOwner.observeLiveData Function ✔️ Android lifecycle, Detail -- This is a function when observation of LiveData is needed.
daijishouUriHandler Object ✔️ Android lifecycle -- See document for more details.
localStorage Object ✔️ W3School, HTML Standard -- Simple solution for storing data. Html localStorage object implemented by Daijishou.
createSQLiteOpenHelper Function ✔️ Android SQLite3, Android SQLiteOpenHelper, Detail -- Complicated yet more thorough solution for storing data.
getJavaClassMethods Function -- debug Get Java object's class methods in string list.
getJavaClassFields Function -- debug Get Java object's class fields in string list.
File (Extension & V8)
installedDirectory String -- files Get directory path where the extension is installed.
dataDirectory String -- files Directory path for Javascript Runtime to store data.
cacheDirectory String -- files Directory path for Javascript Runtime to store cache files. Those files can be cleaned by Daijishou when necessary.
tempDirectory String -- files Directory path for temporary files. Cleaned up on every startup. Unlike cache directory, this for one time use scenario.
File Class ✔️ Java File files --
Files Object ✔️ Java Files files --
Path Class ✔️ Java Path files --
Paths Object ✔️ Java Paths files --
Database (Extension & V8)
daijishouLibraryRepository Object ✔️ Documentation library See document for more details.
retroAchievementsRepository Object ✔️ Documentation retro_achievements See document for more details.
syncLibrary Function ✔️ -- library Sync and backup library.
backupLibrary Function ✔️ -- library Only backup library.
Internet (Extension & V8)
URI Class ✔️ Java URI internet --
URL Class ✔️ Java URL, Java Http Request internet --
URLConnection Class ✔️ Java URLConnection internet --
HttpURLConnection Class ✔️ Java HttpURLConnection internet --
jsoup Object ✔️ Jsoup internet --
dsess Object ✔️ Detail, Syntax internet --
scraper Object ✔️ Detail internet --
Interaction (Extension & V8)
toast Function ✔️ Detail interactions --
showPlayableItemChooserDialog Function ✔️ Detail interactions Pop up a dialog to ask for a playableItem.
showAcknowledgementDialog Function ✔️ Detail interactions Pop up a yes-or-no dialog. With message.
showRetroAchievementsGameDialogByGameId Function ✔️ Detail interactions Pop up a RetroAchievements dialog by gamd id.
Daijishou (Extension & V8)
application Object ✔️ Android application all Daijishou Application Object. This object is for debug, and internal uses.
daijishouUUID String -- system Daijishou UUID of the device.
getDaijishouUptime Function -- system Daijishou UUID of the device.
daijishouVersionCode Int -- -- Daijishou's version.
daijishouVersionName String -- -- Daijishou's version.
Me (Only Extension)
me.id String -- -- --
me.name String -- -- --
me.description String -- -- --
me.authors String -- -- --
me.version String -- -- --
me.apiLevel String -- -- --
me.permissions String List -- -- --
me.getUptime Function ✔️ -- -- --
Implementation (Only Extension)
proposeImplementation Function ✔️ -- -- --
ScraperImplementation Class ✔️ -- ? --
LibraryWebViewImplementation Class ✔️ -- ? --
Extension's Resource (Only Extension)
getString Function ✔️ -- -- Localisation.
Other (Only Extension)
-- -- -- -- -- --