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

xebra.js

v1.2.5

Published

Xebra connects Max to the browser, and the browser to Max.

Downloads

9

Readme

xebra.js

Xebra connects Max to the browser, and the browser to Max. Max is a visual programming language for music and multimedia developed and maintained by Cycling '74.

Adding a mira.frame object to a Max patcher creates an open websocket that exposes the contents of the Max patcher. Xebra connects to that socket and maps changes in the Max patcher to JavaScript events.

Setup

Getting started with Xebra is quite simple. Just grab one of the pre-built versions from here:

Alternatively you can install Xebra using npm

$> npm install xebra.js

Learn

Basic Usage Example

From a web browser, start a websocket connection to Max by creating a new Xebra.State object.

var xebraState = new Xebra.State({
	hostname: "127.0.0.1",
	port: 8086,
	supported_objects: Xebra.SUPPORTED_OBJECTS
});
xebraState.connect();

The value of hostname can be something other than 127.0.0.1, provided the browser can open a websocket connection to that IP address. The port should always be 8086, unless Max displays a different port number in the console after creating a mira.frame object. The supported_objects property specifies which objects Xebra should listen to. The Xebra namespace value SUPPORTED_OBJECTS contains all of the objects currently supported by Xebra.

After connecting, Xebra will fire object_added, object_changed and object_removed events as objects are added, changed and removed. To print an object, whenever it is added or removed, you could write something like:

xebraState.on("object_added", function(object) {
	console.log("Added new object", object);
});

xebraState.on("object_removed", function(object) {
	console.log("Removed an object", object);
});

object_changed events include a param argument, which specifies the changed parameter and gives you access to its value.

xebraState.on("object_changed", function(object, param) {
	console.log("Parameter", param.type, "changed to", param.value, "for object", object);
});

As well as receiving parameter update events, it is also possible to update the state of objects in Max. To set the current value of a slider object, for example:

var sliderObj;
sliderObj.setParamValue("distance", 72);

will set the value of the slider object associated with sliderObj to 72.

For more examples and tutorials please check the examples folder and the tutorials section in the documentation.

API Reference

Check out, learn more and use the Xebra.js API using the documentation.

Contribute

You like the Xebra project and would like to contribute? Perfect! Please use the GitHub issue tracker in case you experience any bugs or get in touch for your feature requests or potential features you'd like to add. Please make sure to read our Contributing Guide before submitting any changes.

Contributing Guide

How To Build

Note that most users won't need to do this and should rather use the pre-built versions or make use of xebra as a npm dependecy. However if you are developing xebra you might need to build.

Make sure you have followed the global repository setup instructions first in order to have all dependencies setup correctly.

Xebra is written in ES6. Based on that the build process covers generating the ES5 versions to the lib folder or generating the bundled files in the dist folder via

$> yarn run build

Generate the Documentation

The documentation for this module is written and build using JSDoc style syntax and helpers.

If you would like to rebuild the documentation please run

$> yarn run docs

For convenience we also host the latest version of the documentation online.

License

MIT