npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wonderlandengine/api

v1.2.4

Published

Wonderland Engine's JavaScript API.

Downloads

1,628

Readme

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.