Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
ember-responds-to
Advanced tools
This Ember CLI addon makes it easy to handle browser events in your components.
resize
and call resize
.scroll
and call scroll
.enterKeydown
and call enterKeydown
.escKeydown
and call escKeydown
.The scroll and resize events are debounced using requestAnimationFrame
.
The enter and esc keydown event handlers are called in LIFO order and each can stop "propagation" with a truthy return value.
Install the addon.
ember install ember-responds-to
Import the mixins in a component and use the events or the handlers.
import Ember from 'ember';
import RespondsToEnterKeydown from 'ember-responds-to/mixins/responds-to-enter-keydown';
import RespondsToEscKeydown from 'ember-responds-to/mixins/responds-to-esc-keydown';
import RespondsToResize from 'ember-responds-to/mixins/responds-to-resize';
import RespondsToScroll from 'ember-responds-to/mixins/responds-to-scroll';
export default Ember.Component.extend(
RespondsToEnterKeydown,
RespondsToEscKeydown,
RespondsToResize,
RespondsToScroll,
{
classNameBindings: [ 'isLandscape:landscape:portrait' ],
enterKeydown: function () {
this.sendAction('submit');
},
escKeydown: function () {
this.sendAction('close');
},
logResize: function () {
console.log('resize event triggered');
}.on('resize'),
logScroll: function () {
console.log('scroll event triggered');
}.on('scroll'),
resize: () => console.log('resize handler called'),
scroll: () => console.log('scroll handler called'),
setLandscape: function () {
this.set('isLandscape', window.innerWidth > window.innerHeight);
}.on('didInsertElement', 'resize'),
});
If you use phantomjs
for testing you need to include a polyfill for requestAnimationFrame
. To do so, add the file at https://gist.github.com/paulirish/1579671 to vendor/
and add the following line to your ember-cli-build.js
.
app.import('vendor/rAF.js', { type: 'test' });
FAQs
Ember mixins for browser event handling.
The npm package ember-responds-to receives a total of 4 weekly downloads. As such, ember-responds-to popularity was classified as not popular.
We found that ember-responds-to demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.