JSPM

neutrino-preset-class-properties

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q13679F
  • License Apache-2.0

Neutrino preset for using the newer class properties (fields) & static properties.

Package Exports

  • neutrino-preset-class-properties

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (neutrino-preset-class-properties) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

neutrino-preset-class-properties

NPM version

This project provides a Neutrino preset for transforming class properties. Uses the Babel Class properties transform which includes:

class Bork {
    //Property initializer syntax
    instanceProperty = "bork";
    boundFunction = () => {
      return this.instanceProperty;
    }

    //Static class properties
    static staticProperty = "babelIsCool";
    static staticFunction = function() {
      return Bork.staticProperty;
    }
  }

If you're using Mobx with React, you'll need decorators, class properties and the React neutrino presets. Here's a single preset that will take care of that: jke-neutrino-preset-react-mobx

Usage

Create a project with a package.json like this.

{
   "name": "myapp",
   "version": "1.0.0",
   "config": {
      "presets": [
         "neutrino-preset-class-properties"
      ]
   },
   "scripts": {
      "build": "neutrino build",
      "start": "neutrino start"
   },
   "dependencies": {
   },
   "devDependencies": {
      "neutrino": "^4.3.1",
      "neutrino-preset-class-properties": "0.1.1"
   }
}

Now you are ready to put your React components into src/ and start coding. Be aware that Neutrino creates the HTML template for you automatically. For more information see the web sites for Neutrino, React and MobX.

Peer dependencies

peerDependency status