Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
ember-destroyable-polyfill
Advanced tools
Changelog
v2.0.3 (2021-01-22)
ember-source
version of project (#136) @alexlafroscia)Readme
Polyfill for RFC 580 "Destroyables".
ember install ember-destroyable-polyfill
For addons, pass the -S
flag.
ember-cli-babel
v7.22.1 or aboveAdds an API for registering destroyables and destructors with Ember's built in destruction hierarchy.
import { registerDestructor } from '@ember/destroyable';
class MyComponent extends Component {
constructor() {
let timeoutId = setTimeout(() => console.log('hello'), 1000);
registerDestructor(this, () => clearTimeout(timeoutId));
}
}
The API will also enable users to create and manage their own destroyables, and associate them with a parent destroyable.
import {
associateDestroyableChild,
registerDestructor
} from '@ember/destroyable';
class TimeoutManager {
constructor(parent, fn, timeout = 1000) {
let timeoutId = setTimeout(fn, timeout);
associateDestroyableChild(parent, this);
registerDestructor(this, () => clearTimeout(timeoutId));
}
}
class MyComponent extends Component {
manager = new TimeoutManager(this, () => console.log('hello'));
}
For detailed usage instructions, refer to the RFC 580 "Destroyables".
TypeScript's normal type resolution for an import from @ember/destroyable
will not find this the types provided by this package (since TypeScript
would attempt to resolve it as node_modules/@ember/destroyable
or under
the Definitely Typed location for @ember/destroyable
). Once the
@ember/destroyable
API is a documented part of Ember's API, the
Definitely Typed folks will gladly accept adding that API, but in the
meantime users will need to modify their tsconfig.json
to tell TypeScript
where these types are.
Add the following to your tsconfig.json
:
{
// ...snip...
"paths": {
// ...snip...
"@ember/destroyable": ["node_modules/ember-destroyable-polyfill"],
}
}
FAQs
Polyfill for RFC 580: Destroyables
The npm package ember-destroyable-polyfill receives a total of 76,217 weekly downloads. As such, ember-destroyable-polyfill popularity was classified as popular.
We found that ember-destroyable-polyfill demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).