OOjs
OOjs |
---|
Features |
See also |
Az OOjs („Object-oriented JavaScript”) JavaScript-könyvtár az objektumokkal való foglalkozáshoz. Funkciói közé tartoznak az öröklődés , a mixinek , a statikus öröklődés és a tömbök. It also provides an EventEmitter mixin for event-driven programming, and a factory pattern for decoupling consumers of functionality from any particular class's implementation.
Funkciók
Öröklődés
OO.inheritClass( childClass, parentClass )
Extend prototype and static methods and properties of child constructor from a parent constructor.
OO.mixinClass( childClass, parentClass )
Copy prototype and static methods and properties to a child constructor from a parent constructor.
Initialise 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.
Események
Allow event handlers to be attached, called when events occur, and detached.
Regisztrációk és gyárak
Provide a simple map interface for associating arbitrary data with a symbolic name.
Registry of classes with instantiation abstraction.
Eszközök
See the API documentation for a complete reference of available utilities.
Kompatibilitás
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 IE8 and before), but users need a polyfill to provide required ECMAScript 5 methods.
It is packaged to be run in either Web browsers or Node.js.
Névtér
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 OO
.
You may access OO
the same way you would access jQuery
or mediaWiki
.
If you are using eslint, you should add the following to your .eslintrc.json
file.
"globals": {
"OO": "readonly"
}
Lásd még
OOjs
|
További információk
- Source code on phabricator.wikimedia.org/diffusion/ (GitHub mirror)
- Package on npmjs.org
- Phabricator project (issue tracker)
- API Documentation
![]() | OOjs is maintained by the Editing department.
Get help:
|