Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
ember-cli-hooks
Advanced tools
This is an experimental addon that allows you to use react style hooks inside of ember. In theory this should allow you to create your Ember components without ever using the this
keyword. Additionally I have wrapped the ember props in a proxy that handles getting and setting for you. This should allow you to just set and get like you would with normal objects. This is still WIP and experimental.
import Component from '@ember/component';
import layout from '../templates/components/counter-with-hooks';
import EmberHooksMixin, { useProperties } from 'ember-hooks/mixins/ember-hooks';
export default Component.extend(EmberHooksMixin, {
layout,
hooks() {
// Use properties will automatically bind this data to your components scope
const state = useProperties({
count: 0,
});
// Note that you don't need to refer to this, instead you can mutate the values directly
const increment = () => {
state.count = state.count + 1;
}
// What gets returned here will bind to your component
return {
actions: {
increment,
}
};
}
});
<h3>Count: {{count}}</h3>
<button onclick={{action "increment"}}>Increment</button>
import { withHooks } from "ember-hooks/mixins/ember-hooks";
import useCounter from "../hooks/useCounter";
// withHooks will return a component with the mixin already attached
// You can still pass in additional mixins as arguments before props
const CounterUsingWithHooksComponent = withHooks(props => {
// Explicitly deconstruct the values you want to use from the hook
const { count, increment } = useCounter();
return {
count,
actions: {
increment,
},
};
});
export default CounterUsingWithHooksComponent;
ember install ember-hooks
[Longer description of how to use the addon in apps.]
git clone https://github.com/twaite/ember-hooks
cd ember-hooks
yarn
yarn lint:hbs
yarn lint:js
yarn lint:js -- --fix
ember test
– Runs the test suite on the current Ember versionember test --server
– Runs the test suite in "watch mode"ember try:each
– Runs the test suite against multiple Ember versionsember serve
For more information on using ember-cli, visit https://ember-cli.com/.
This project is licensed under the MIT License.
FAQs
React/Vue Style Hooks for Ember
The npm package ember-cli-hooks receives a total of 0 weekly downloads. As such, ember-cli-hooks popularity was classified as not popular.
We found that ember-cli-hooks demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.