DynamicProto-JS

Generates dynamic prototype methods for JavaScript objects (classes) by supporting method definition within their "class" constructor (like an instance version), this removes the need to expose internal properties on the instance (this) which results in better code minfication and therefore improved load times for your users.

View project on GitHub

Dynamic Proto JavaScript

Generates dynamic prototype methods for JavaScript objects (classes) by supporting method definition within their “class” constructor (like an instance version), this removes the need to expose internal properties on the instance (this) and the usage of ClassName.prototype.funcName() both of which result in better code minfication (smaller output) and therefore improved load times for your users.

The dynamically generated prototype methods support class inheritance of any type, which means you can extend from base classes that use instance or prototype defined methods, you also don’t need to add the normal boiler plate code to handle detecting, saving and calling any previous instance methods that you are overriding as support for this is provided automatically.

So whether creating a new class or extending some other class/code, your resulting code, can be successfully extended via TypeScript or JavaScript.

Documentation

Typedoc API references.

Included NPM distribution formats

As part of the build / publish formats via NPM we include the following module formats:

  • dist/esm – Used as the “module” definition for npm, which keeps the bundle as an ES module file, suitable for other bundlers and inclusion as a < amd – Asynchronous Module Definition, used with module loaders like RequireJS
  • dist/node - Used as the “main” npm entry point for the utility, using the umd format with any third party modules located and included using the Node resolution algorithm

Other included formats

  • dist/cjs – CommonJS, suitable for Node and other bundlers script type=module> tag in modern browsers
  • dist/iife – A self-executing function, suitable for inclusion as a <script> tag. (If you want to create a bundle for your application, you probably want to use this.)
  • dist/umd – Universal Module Definition, works as amd, cjs and iife all in one
  • dist/system – Native format of the SystemJS loader

Browser Support

Chrome Firefox IE8 Edge Opera Safari
Latest ✔ Latest ✔ 8+ Full ✔ Latest ✔ Latest ✔ Latest ✔