Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abel-n/ember-argument-decorator
A convenience decorator for Glimmer component argument default values
https://github.com/abel-n/ember-argument-decorator
decorator ember ember-addon ember-argument-decorator glimmer-components
Last synced: 30 days ago
JSON representation
A convenience decorator for Glimmer component argument default values
- Host: GitHub
- URL: https://github.com/abel-n/ember-argument-decorator
- Owner: abel-n
- License: mit
- Created: 2020-03-05T12:48:21.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-12T03:55:06.000Z (about 2 years ago)
- Last Synced: 2024-11-16T17:39:41.562Z (about 1 month ago)
- Topics: decorator, ember, ember-addon, ember-argument-decorator, glimmer-components
- Language: JavaScript
- Size: 1.5 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
ember-argument-decorator
==============================================================================This decorator is a wrapper for providing argument defaults for Glimmer components in a simple manner. It supports primitives, objects and functions. It also seems to support getters but that is untested yet.
Compatibility
------------------------------------------------------------------------------* Ember.js v3.12 or above
* Ember CLI v2.13 or above
* Node.js v10 or aboveInstallation
------------------------------------------------------------------------------```shell
ember install ember-argument-decorator
```Usage
------------------------------------------------------------------------------Provide default value in component.
```js
import Component from '@glimmer/component';
import argument from 'ember-argument-decorator';export default class XComponent extends Component {
@argument searchEnabled = true
}
```Use `this.argumentName` instead of `@argumentName` to refer to it in template.
```hbs
{{#if this.searchEnabled}}
{{!-- do something --}}
{{/if}}
```The decorator updates the reference when arguments change.
```hbs
```
License
------------------------------------------------------------------------------This project is licensed under the [MIT License](LICENSE.md).