Globals

Note: This documentation is for the old 1.3.0 version of A-Frame. Check out the documentation for the current 1.6.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.
registerElement A flavor of document.registerElement for A-Frame nodes calls parent prototype handlers before child ones. The base class of A-Frame elements. Also see registerPrimitive for registering an A-Frame elements similar to <a-box>.
registerGeometry Function to register a geometry.
registerPrimitive Function to register a primitive.
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.

global.window = require('jsdom').jsdom().defaultView;
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.