1.3.3 • Published 10 months ago

@wonderlandengine/api v1.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Wonderland Engine API

The bindings between Wonderland Engine's WebAssembly runtime and custom JavaScript or TypeScript components.

Learn more about Wonderland Engine at https://wonderlandengine.com.

💡 The Wonderland Engine Runtime is compatible on all patch versions of the API, but the major and minor versions are required to match.

Example: You will be able to use Wonderland Editor 1.0.4 with API version 1.0.0 or 1.0.9 for example, but not with API 1.1.0. 💡

Usage

Wonderland Engine projects usually come with this package pre-installed. Install via npm or yarn:

npm i --save @wonderlandengine/api
# or:
yarn add @wonderlandengine/api

To update the API to the latest version use

npm i --save @wonderlandengine/api@latest

Writing a Custom Component

JavaScript

import {Component, Property} from '@wonderlandengine/api';

class Forward extends Component {
    static TypeName = 'forward';
    static Properties = {
        speed: Property.float(1.5)
    };

    _forward = new Float32Array(3);

    update(dt) {
        this.object.getForward(this._forward);
        this._forward[0] *= this.speed*dt;
        this._forward[1] *= this.speed*dt;
        this._forward[2] *= this.speed*dt;
        this.object.translateLocal(this._forward);
    }
}

TypeScript

import {Component} from '@wonderlandengine/api';
import {Component} from '@wonderlandengine/api/decorators.js';

class Forward extends Component {
    static TypeName = 'forward';

    @property.float(1.5)
    speed!: number;

    private _forward = new Float32Array(3);

    update(dt) {
        this.object.getForward(this._forward);
        this._forward[0] *= this.speed*dt;
        this._forward[1] *= this.speed*dt;
        this._forward[2] *= this.speed*dt;
        this.object.translateLocal(this._forward);
    }
}

For more information, please refer to the JavaScript Quick Start Guide.

For Library Maintainers

To ensure the user of your library can use a range of API versions with your library, use "peerDependencies" in your package.json:

"peerDependencies": {
    "@wonderlandengine/api": ">= 1.0.0 < 2"
},

Which signals that your package works with any API version >= 1.0.0 (choose the lowest version that provides all features you need) until 2.0.0.

Also see the Writing JavaScript Libraries Tutorial.

1.3.3

10 months ago

1.3.2

11 months ago

1.3.1

11 months ago

1.3.0

12 months ago

1.3.0-rc.3

12 months ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.2.0-rc.1

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.0-rc.1

2 years ago

1.0.1

3 years ago

0.9.8

3 years ago

0.9.7

3 years ago

1.0.0

3 years ago

1.0.0-rc.7

3 years ago

1.0.0-rc.8

3 years ago

1.0.0-rc.5

3 years ago

1.0.0-rc.6

3 years ago

1.0.0-rc.3

3 years ago

1.0.0-rc.4

3 years ago

1.0.0-rc.1

3 years ago

1.0.0-rc.2

3 years ago

0.9.4

3 years ago

0.9.3

3 years ago

0.9.6

3 years ago

0.9.5

3 years ago

0.9.0

3 years ago

0.9.2

3 years ago

0.9.1

3 years ago

0.8.10

4 years ago

0.8.9

4 years ago

0.8.8

4 years ago

0.8.7

5 years ago

0.8.6

5 years ago

0.8.5-1

5 years ago

0.8.5

5 years ago