Globals

NOTE: This version of the documentation tracks unstable development happening on A-Frame’s master branch. If you wish to try it out, grab the unstable build. Otherwise, head to the documentation for the current 1.5.0 version

A-Frame exposes its public interface through the window.AFRAME browser global. This same interface is also exposed if requiring with CommonJS (require('aframe')).

AFRAME Properties

Property Description
AComponent Component prototype.
AEntity Entity prototype.
ANode Base node prototype that A-Frame elements inherit from.
AScene Scene prototype.
components Object of registered components.
geometries Object of registered geometries .
primitives.primitives Object of registered primitives.
registerComponent Function to register a component.
registerGeometry Function to register a geometry.
registerPrimitive Function to register a primitive like registering an A-Frame elements similar to <a-box>.
registerShader Function to register a material or shader.
schema Schema-related utilities.
shaders Object of registered shaders.
systems Object of registered systems.
THREE Global three.js object.
utils A-Frame utility modules.
version Version of A-Frame build.

window Properties

Property Description
AFRAME The object described above.
hasNativeWebVRImplementation Whether the client has native WebVR support.

Requiring AFRAME in a Node.js Environment

It is possible to run A-Frame in Node.js to get access to its globals. The only catch is we need to supply a browser window mock since Node.js lacks a window object. A-Frame is tested with jsdom, although any JavaScript-based browser implementation should work.

const jsdom = require("jsdom");
global.window = new jsdom.JSDOM().window;
var aframe = require('aframe/src');
console.log(aframe.version);

Although A-Frame can load in Node.js, A-Frame isn’t (yet) able to run any simulations at run time.