@7rabbit/ink-runtime 中文文档教程

发布于 5年前 浏览 27 项目主页 更新于 3年前















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)

使用 argssource 上调用 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



IntroductionInstallationIllustration




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.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文