Skip to content

Releases: traitsjs/traits.js

Maintenance release

19 Sep 04:12
Compare
Choose a tag to compare

Fixes bug #11 - Trait.create throws if prototype === null.

const o = Trait.create(
  null,
  Trait({ a:0, b:function(){ return this.a; } }));

UMD support

01 Jan 22:13
v1.1.4
8b91397
Compare
Choose a tag to compare

Version 1.1

This release just changes how traits.js is consumed and published. A lot of other small project maintenance fixes also goes into this release but that should be transparent to you. We now publish an UMD capable version, both minified and normal, reachable from https://unpkg.com/traits.js@1/. UMD support means that traits.js can be consumed by AMD loaders (Require.JS), CommonJS loaders (Node.js) while still be accessible through the global context in the browser via the Trait reference.

We also pack src/traits.js directly in the npm module so you can import it (though you have to know the path) via ES2016 loaders when they land in browsers (currently only Safari).

import Trait from 'https://unpkg.com/traits.js@1/src/traits.js'

Support for Node.js --experimental-modules can easily be accommodated via the newly added rollup.js packager if there is interest.

Added

  • Npm pre-publish hook now creates a dist/ directory with traits.js and traits.min.js. This allow for using the minified version through https://unpkg.com.
  • Added changelog.
  • Mention unpkg.com include option and fixed some formatting errors in markdown files.

Changed

  • Npm main file no longer points to src/traits.js but to dist/traits.js. Since this is the unminified version, your module bundler can optimize the minification process according to your project.
  • Updated dev dependencies. Note that, qunit can not be updated to any version higher than 2.4.1 due to karma-qunit.

Removed

  • Two CommonJS detections in traits.js.