@7rabbit/ink-runtime 中文文档教程
ink-runtime
Ink 基本 JavaScript 操作
Introduction
Ink 运行时是构建的所有基本 JavaScript 函数。
Installation
npm install @7rabbit/ink
npm install @7rabbit/ink-runtime
Illustration
这是一个 Hello World 示例。
import runtime from '@7rabbit/ink-runtime'
import Ink from '@7rabbit/ink'
let ink = new Ink()
ink.attachModule(runtime)
下面的其余部分是一个 API 参考,记录了 ink-runtime
附加到 ink
对象的每个方法。
commitAspect(source, aspect, object)
将 source
上的字段、属性或特性 aspect
设置为 object
。
detachAspect(source, aspect)
分离 source
上的字段、属性或属性 aspect
。
invokeMethod(source, method, ...args)
使用 args
在 source
上调用 method
。
wait(delay, action)
延迟调用 action
delay
毫秒。
throttle(threshhold, action)
每 threshold
毫秒调用一次 action
,即使它在 threshold
毫秒内被调用多次。
addListener(source, type, action)
当从 source
听到事件 type
时调用 action
。
requestAnimationFrame(action)
等待下一个动画步骤运行环境提供的action
。
import([path|function])
导入在 path
中找到的模块,或提供一个 function
来解析相对于当前文件的路径。
ink-runtime
Ink basic JavaScript actions
Introduction • Installation • Illustration
Introduction
The Ink runtime is all the basic JavaScript functions to build upon.
Installation
npm install @7rabbit/ink
npm install @7rabbit/ink-runtime
Illustration
This is a Hello World example.
import runtime from '@7rabbit/ink-runtime'
import Ink from '@7rabbit/ink'
let ink = new Ink()
ink.attachModule(runtime)
The rest of what follows is an API reference documenting every method ink-runtime
attaches to the ink
object.
commitAspect(source, aspect, object)
Set the field, property, or attribute aspect
on source
to object
.
detachAspect(source, aspect)
Detach the field, property, or attribute aspect
on source
.
invokeMethod(source, method, ...args)
Call the method
on source
with args
.
wait(delay, action)
Delay invoking action
for delay
milliseconds.
throttle(threshhold, action)
Invoke the action
once every threshold
milliseconds, even if it is called multiple times within threshold
milliseconds.
addListener(source, type, action)
Invoke the action
when event type
is heard from source
.
requestAnimationFrame(action)
Wait for the next animation step to run action
provided by the environment.
import([path|function])
Import the module found at path
, or provide a function
to resolve the path relative to the current file.