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 🙏

© 2025 – Pkg Stats / Ryan Hefner

artemisjs

v0.0.2

Published

A Javascript port of the entity component framwork Artemis

Downloads

7

Readme

ArtemisJs

A javascript port of Artemis Entity System Framework. It retains most of the Java version's API and should be able to run on both the client side (script tag or AMD) and server side (CommonJs).


##Differences with the original Java version

  • delayedEntityProcessingSystem: will keep running until there's no more entity to process (all entities have timed out)
  • bag: remove(int) -> removeByIndex remove(E) -> removeElement
  • component/manager/system types are differentiated using a type property (componentType, managerType and systemType respectively) which need to be set using Object.defineProperty.

##How to use

###Setup

####Web

Simply use a script tag. This will add a variable artemis to the global space.

<script src="Artemis.js"></script>

or

<script src="Artemis.min.js"></script>

####AMD

RequireJs example:

require(["Artemis"], function(artemis) {
  // do something here
});

####CommonJs

TODO

###Create a world

var world = artemis.world.create();

world.setSystem(movementSystemInstance);

world.initialize();

###Define a component Use the ExtendHelper to extend the default component or an another component. Component types are differentiated using componentType property (configurable but not enumerable/writable).

var positionComponent = artemis.ExtendHelper.extendComponent(artemis.component, "positionComponent", {
  create: function (x, y) {
    var self = Object.create(this);
    self.x = x;
    self.y = y;
    return self;
  }
});

If you don't want to use ExtendHelper, you will need to use Object.defineProperty to change componentType.

###Create an entity An entity has to be created from the world instance.

var entity = world.createEntity();
entity.addComponent(positionComponent.create());
entity.addToWorld();

###Define an entity system

Similiarly to component, system types are differentiated using systemType property.

var movementSystem = artemis.ExtendHelper.extendSystem(artemis.entityProcessingSystem, "movementSystem", {
  __componentTypes: ["positionComponent", "velocityComponent"],
  create: function () {
    var aspect = artemis.Aspect.getAspectForAll.apply(null, this.__componentTypes);
    var self = artemis.entityProcessingSystem.create.call(this, aspect);
    return self;
  },
  processEntity: function (e) {
    var position = this.positionComponentMapper.get(e);
    var velocity = this.velocityComponentMapper.get(e);

    position.x += velocity.vectorX * this.getWorld().getDelta();
    position.y += velocity.vectorY * this.getWorld().getDelta();
  }
});

and to create a system:

var movementSystemInstance = movementSystem.create();

Component Mappers are injected into the system via __componentTypes property. This could be a string or an array of component type (which should be set when defining a component). You can access these mappers with the convention: componentType + Mapper


##Running the example

The example is the spaceship warrior example port. It is written using Cocos2d-html5 for rendering.

To run it, you will need the Cocos2d-html5 version. You can download the newest version here. The newest version at the moment is v2.2.1.

Then simply copy the example folder into the Cocos2d-html5 folder and run index.html file. It should run with no problem on Firefox, you might need a server to run on other browser.


##Documentation

Visit the wiki.