系统 API
系统 API 处于对象 Mota 上,是使用新样板 API 的根对象
require()
ts
declare function require(type: InterfaceType, key: string): any参数说明
type: 要获取的 API 类型,目前包含classfnvarmodule四种类型,分别表示类、函数、变量、模块key: 要获取的 API 的名称
方法说明
获取一个样板接口
requireAll()
ts
declare function requireAll(type: InterfaceType): any方法说明
获取一种 API 类型的所有接口,并以对象的形式返回
rewrite()
ts
declare function rewrite(
base: any,
key: string,
type: 'full' | 'add' | 'front',
re: Function,
bind?: any,
rebind?: any
): Function方法说明
复写函数,参考函数复写
r()
ts
declare function r(fn: (packages: PackageInterface) => void, thisArg?: any): void参数说明
fn: 要执行的函数,包含一个参数,表示系统使用的第三方库thisArg: 函数执行时绑定的上下文(this 指向)
方法说明
在渲染进程包裹下执行一个函数
rf()
ts
declare function rf(fn: Function, thisArg: any): Function参数说明
fn: 要绑定的函数thisArg: 函数调用时传入的上下文(this 指向)
方法说明
将一个函数包裹为渲染进程函数
Plugin
ts
interface Plugin {
require(key: string): any
requireAll(): any
register(key: string, data: any, init?: any): void
}参考指南
系统自带插件包括
- 渲染进程插件
shadow_rgameShadow_rfly_rpop_rfrag_ruse_rgameCanvas_rsmooth_rshader_r
- 游戏进程插件
utils_gshop_greplay_gremoveMap_gheroFourFrames_grewrite_gitemDetail_gremainEnemy_g
Package
ts
interface Package {
require(key: string): any
requireAll(): any
}参考指南
系统暴露出的第三方库:
axioschart.jsjsziplodashlz-stringmutate-animatevue