ember-cli-puppet

0.2.0 • Public • Published

ember-cli-puppet Build Status

Turn components into puppets. Calling their actions or even functions from parent components / controllers.

Installation

ember install ember-cli-puppet

Usage

Assuming you mix in ember-cli-puppet/mixins/puppet into your-component, this addon allows you to do:

{{your-component onPuppet=(action (mut instance))}}

<button {{action (puppet-call instance 'func_name')}}>Call the func_name function of the component</button>
<button {{action (puppet-send instance 'act_name')}}>Invoke the act_name action of the component</button>

Alternatives

  • ember-component-inbound-actions - okay but can lead to rerender issues
  • Modifying parameters and having the component monitor for changes - pure ugliness

FAQ

  • Doesn't this break the DDAU principle? Absolutely! Use at your own risk.
  • When should I handle the offPuppet event? If you modify a controller's state during the onPuppet event, then it makes sense to clean up during offPuppet. You can skip that for components since they clean up after themselves once they get destroyed.

Contributing

Installation

  • git clone <repository-url>
  • cd ember-cli-puppet
  • npm install

Linting

  • npm run lint:js
  • npm run lint:js -- --fix

Running tests

  • ember test – Runs the test suite on the current Ember version
  • ember test --server – Runs the test suite in "watch mode"
  • npm test – Runs ember try:each to test your addon against multiple Ember versions

Running the dummy application

For more information on using ember-cli, visit https://ember-cli.com/.

License

This project is licensed under the MIT License.

Readme

Keywords

Package Sidebar

Install

npm i ember-cli-puppet

Weekly Downloads

0

Version

0.2.0

License

MIT

Unpacked Size

7.85 kB

Total Files

12

Last publish

Collaborators

  • andyhot