{"name":"class-autobind","version":"0.1.4","description":"Method auto-bind for ES6 (ES2015) classes","main":"lib/autobind.js","scripts":{"build":"rimraf lib && babel src --ignore '_*' --out-dir lib","prepublish":"npm run build","lint":"eslint --max-warnings 0 .","typecheck":"flow","test-src":"mocha src/__tests__/*.js src/**/__tests__/*.js","test":"npm run lint && npm run typecheck && npm run test-src"},"dependencies":{},"devDependencies":{"babel-cli":"^6.10.1","babel-core":"^6.9.1","babel-eslint":"^6.0.4","babel-plugin-transform-class-properties":"^6.9.1","babel-preset-es2015":"^6.9.0","babel-preset-es2015-loose":"^7.0.0","babel-preset-react":"^6.5.0","babel-preset-stage-2":"^6.5.0","eslint":"^2.12.0","eslint-plugin-babel":"^3.2.0","eslint-plugin-flow-vars":"^0.4.0","eslint-plugin-react":"^5.1.1","expect":"^1.20.1","flow-bin":"^0.27.0","mocha":"^2.5.3","rimraf":"^2.5.2"},"repository":{"type":"git","url":"git+ssh://git@github.com/kodefox/class-autobind.git"},"keywords":["react","autobind","es6-class"],"author":{"name":"team@kodefox.com"},"license":"ISC","bugs":{"url":"https://github.com/kodefox/class-autobind/issues"},"homepage":"https://github.com/kodefox/class-autobind#readme","gitHead":"eb4a71db17ee5b90d048bea0abe79c07762c9ec8","_id":"class-autobind@0.1.4","_shasum":"34516c49167cf8d3f639ddc186bcfa2268afff34","_from":".","_npmVersion":"3.7.3","_nodeVersion":"5.8.0","_npmUser":{"name":"sstur","email":"sstur@me.com"},"dist":{"shasum":"34516c49167cf8d3f639ddc186bcfa2268afff34","tarball":"http://registry-npm.ywwl.com/class-autobind/download/class-autobind-0.1.4.tgz","integrity":"sha512-Hd4wk0aVnIiMKCI/qA006/U+yOlbLV0BVAeaQqh9NyQZMPWfIOJh5fPZqN3T9Y9UydYdfIa27Hxp+dPh7jYT3w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFAEPin3bTOV2tynINZ32YMD3/wYYFoI7L1z2OsXVHu/AiAJNzGsxx0CEjuY01o3bYFvFHiJe0uHWFoeuUbOkxBPcw=="}],"size":2558,"noattachment":false,"key":"/class-autobind/-/class-autobind-0.1.4.tgz"},"maintainers":[{"name":"sstur","email":"sstur@me.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/class-autobind-0.1.4.tgz_1465820551063_0.6523885580245405"},"directories":{},"readme":"# Method auto-bind for ES6 (ES2015) classes\n\nThis package provides a single function, `autobind`, for use within a constructor to bind all methods to the instance itself.\n\nFor example, this allows us to pass a method to an event handler `element.addEventListener('click', this.onClick)` and be sure the `onClick` method will always be called with the right context.\n\nNote: This has some specific logic for React, but could be used in any project.\n\n## Usage:\n\n```js\nimport autobind from 'class-autobind';\n\nclass MyComponent extends React.Component {\n  constructor() {\n    super(...arguments);\n    autobind(this);\n  }\n  render() {\n    return <button onClick={this.onClick}>Click Me</button>;\n  }\n  onClick() {\n    console.log('Button Clicked');\n  }\n}\n```\n\n## Advanced Usage:\n\nIf your component will possibly be subclassed (you really should not do this, but some third-party libraries like [react-css-modules](https://npmjs.com/package/react-css-modules) do so) then you will need to specify which prototype will be the source of methods that are to be automatically bound.\n\n```js\nimport autobind from 'class-autobind';\n\nclass MyComponent extends React.Component {\n  constructor() {\n    super(...arguments);\n    autobind(this, MyComponent.prototype); // Note the second parameter.\n  }\n  render() {\n    /* ... */\n  }\n}\n\nclass MySubClassedComponent extends MyComponent {\n  /* This is probably a very bad idea. */\n}\n```\n\n## License\n\nThis software is [BSD Licensed](/LICENSE).\n","publish_time":1465820551670,"_cnpm_publish_time":1465820551670,"dist-tags":{"latest":"0.1.4"}}