![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
ember-run-decorators
Advanced tools
This addon utilizes the proposed decorator spec
to provide commonly used Ember.run
methods as decorators.
* Async decorators automatically get cleaned up on destroy
or willDestroyElement
with run.cancel
to prevent nasty bugs and calling set on a destroyed object
errors in your code.
Heavily inspired by rwjblue/ember-computed-decorators.
ember install ember-run-decorators
// ember-cli-build.js
var app = new EmberApp({
babel: {
optional: ['es7.decorators']
}
});
Allows you to specify which context to call the specified function in while adding the execution of that function to the Ember run loop. This ability makes this method a great way to asynchronously integrate third-party libraries into your Ember application.
bind
will always maintain the context of the object the decorated function is a member of.import Ember from 'ember';
import { bind } from 'ember-run-decorators';
const { Component } = Ember;
export default Component.extend({
isShowing: true,
@bind
hideOnESC(e) {
if (e.keyCode === 27) {
this.set('isShowing', false);
}
},
didInsertElement() {
window.addEventListener('keyup', this.hideOnESC, false);
},
willDestroyElement() {
window.removeEventListener('keyup', this.hideOnESC, false);
}
});
Delay calling the target method until the debounce period has elapsed with no additional debounce calls. If debounce is called again before the specified time has elapsed, the timer is reset and the entire period must pass again before the target method is called.
import Ember from 'ember';
import { debounce } from 'ember-run-decorators';
const { Component } = Ember;
export default Component.extend({
@debounce(150)
onScroll(e) {
// Cool infinite scroll code...
},
didInsertElement() {
window.addEventListener('scroll', this.debouncedOnScroll);
},
willDestroyElement() {
window.removeEventListener('scroll', this.debouncedOnScroll);
}
});
Ensure that the target method is never called more frequently than the specified spacing period. The target method is called immediately.
import Ember from 'ember';
import { throttle } from 'ember-run-decorators';
const { Component } = Ember;
export default Component.extend({
isSaved: false,
@throttle(500)
click(e) {
this.send('save');
},
actions: {
save() {
this.set('isSaved', true);
}
}
});
Invokes the passed target/method and optional arguments after a specified period of time.
import Ember from 'ember';
import { later } from 'ember-run-decorators';
const { Component } = Ember;
export default Component.extend({
isShowing: true,
@later(300)
didClose() {
this.attrs.didClose();
},
actions: {
close() {
this.didClose();
this.set('isShowing', false);
}
}
});
ember server
npm test
(Runs ember try:testall
to test your addon against multiple Ember versions)ember test
ember test --server
ember build
For more information on using ember-cli, visit http://www.ember-cli.com/.
git clone
this repositorynpm install
bower install
ember server
npm test
(Runs ember try:testall
to test your addon against multiple Ember versions)ember test
ember test --server
ember build
For more information on using ember-cli, visit http://www.ember-cli.com/.
FAQs
Decorators for Ember.run.
The npm package ember-run-decorators receives a total of 2 weekly downloads. As such, ember-run-decorators popularity was classified as not popular.
We found that ember-run-decorators 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.