OOjs

OOjs (short for "Object-oriented JavaScript") is a JavaScript library for working with objects. Features include classes>OOjs/Inheritance#Classes|inheritance, mixins>OOjs/Inheritance#Mixins|mixins, static>OOjs/Inheritance#Static methods and properties|static inheritance and additional utilities for working with objects and arrays. It also provides an events>OOjs/Events|EventEmitter mixin for event-driven programming, and a reg_fact>OOjs/Registries and factories|factory pattern for decoupling consumers of functionality from any particular class's implementation.

Features
Inheritance

Extend prototype and static methods and properties of child constructor from a parent constructor.

Copy prototype and static methods and properties to a child constructor from a parent constructor.

Initialize a base class to be inherited by, or mixed into, a child class. Only required for classes that do not inherit or mixin other classes.

Events

Allow event handlers to be attached, called when events occur, and detached.

Registries and Factories

Provide a simple map interface for associating arbitrary data with a symbolic name.

Registry of classes with instantiation abstraction.

Utilities

See the API documentation for a complete reference of available utilities.

Compatibility
OOjs is optimised for modern ECMAScript 5 environments. The source code is compatible with the older ECMAScript 3 engine (such as in older versions of Internet Explorer, broadly speaking lte IE8), but users need a polyfill to provide required ECMAScript 5 methods.

It is packaged to be run in either Web browsers or Node.js.

While not dependent on jQuery, there is an optimized package that makes use of jQuery features, resulting in a smaller file being sent to the client.

Namespace
In the presence of a module system, such as in Node.js, OOjs exports all of its classes and methods. In other environments, such as Web browsers, a global variable is created named. You may access  the same way you would access   or.

If you are using JSHint, you should add the following to your  file.