DCL

An elegant OOP with mixins + AOP for JavaScript.

Micro update: 1.1.1

New release of dcl (1.1.1) includes two minor bug fixes:

  • Bugfix: a stray comma in a test file, which acted up in legacy browsers.
  • Bugfix: dcl.mix() was called directly in the base modules preventing it from being monkey-patched.

Most users can safely skip this update, unless they are directly affected by the monkey-patch bug.

1.1: legacy

This is a major update, which includes support for legacy browsers (IE < 9). It doesn’t affect existing users, because it doesn’t change the API or its semantics, but provides an option for legacy applications. It is considered “major” because it changes some internal plumbing.

legacy.js documentation contains all necessary background information for the change, and recommendations on how to use it in real projects.

1.0.4: added to Bower

This is a technical release, which doesn’t change the functionality in any way. You can safely skip it.

The version bump was required in order to add dcl to Bower —– a generic, unopinionated solution to the problem of front-end package management. If you use Bower to manage your project dependencies, you can install dcl like this:

1
bower install dcl

Update: 1.0.3

New update was pushed out. Changes:

  • Bugfix: in some cases when using a native constructor created without dcl it was not called when creating an object. This bug is fixed and relevant tests were added.
  • All tests are consolidated using heya-unit. No more manual tests.
  • Added an automated testing in PhantomJS environment.
  • Increased test coverage.

This update is about maintenance. It doesn’t introduce new features. Given that the fixed bug is quite exotic, this update can be skipped unless your code contains a mix of dcl and non-dcl bases and mixins in the same constructor functions.

dcl added to jam

dcl was added to jam —– the RequireJS-based package manager for front-end projects. If you use jam to manage your project dependencies, you can install dcl like this:

1
jam install dcl

Micro update: 1.0.2

New update was pushed out. Changes:

  • Some instances of new Function were replaced with function(){} to bypass Content Security Policy restrictions, because new Function even without any parameters is considered to be eval (???), and forces to allow eval globally.

This update doesn’t affect any functionality, and can be safely skipped, if you don’t work with security-constrained environments.

Inroduction to dcl

David Walsh has asked me to do a guest blog post. When I offered him to write about dcl, he agreed, and here we go: Introduction to dcl.

If you don’t read David’s blog regularly, and you are serious about web applications, you are missing out. He frequently publishes very interesting articles on JavaScript, CSS, new development in browsers, and so on. Check out his tutorials, demos, and in-depth articles. Get yourself in the know.

1.0.1 is out

1.0.1 is a minor update. This version has following changes:

  • Added getInherited() as an alias for inherited.get() to simplify its use. Now there is no need to use call() or apply() to specify its instance.
  • Added tests for dcl exceptions.
  • Added tests for canned advices and mixins.
  • Changed export names for <script> inclusion.
  • Error messages are better formatted.
  • Minor clean up, better comments, documentation updates.

So far dcl has proved to be fairly stable, no major bugs were found. Almost all changes in 1.0.1 are backward-compatible, and upgrading to it should be transparent.

The only non-compatible change is export names with <script> tags, which are not recommended anyway — when in browser please use an AMD loader like RequireJS.

1.0 is public

Finally after months of private use 1.0 version of dcl is out in the open.

What is dcl? It is a micro library for OOP/AOP. It works in node.js and modern browsers, supports AMD, and completely open source.

Fork me on GitHub