Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
inversify-hooks
Advanced tools
Wrapper of inversify-props to inject your dependencies in the components, made with TypeScript using hooks.
This package is a wrapper of inversify-props to simplify how inject your dependencies in components with hooks.
$ npm install inversify-hooks reflect-metadata --save
The inversify-hooks type definitions are included in the inversify-hooks npm package.
import 'reflect-metadata'; // Import only once
import { container, useContainer } from 'inversify-hooks';
container.addSingleton<IService1>(Service1);
function ExampleComponent() {
const service1 = useContainer<IService1>(cid.IService1);
useEffect(() => {
service1.asyncMethod();
}, [])
}
container.addSingleton<IService1>(Service1, 'MyService1');
function ExampleComponent() {
const service1 = useContainer<IService1>('MyService1');
}
:warning: Important! inversify-hooks requires TypeScript >= 2.0 and the
experimentalDecorators
,emitDecoratorMetadata
,types
andlib
compilation options in yourtsconfig.json
file.
{
"compilerOptions": {
"target": "es5",
"lib": ["es6"],
"types": ["reflect-metadata"],
"module": "commonjs",
"moduleResolution": "node",
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}
There are more examples of how to use the container in services or other components in inversify-props
You can learn more about why we made this packages in the original repo.
If you're not familizared of how to register dependencies, check the docs.
f you're using Uglify or Terser you need to configure well the plugin, check the docs.
FAQs
Wrapper of inversify-props to inject your dependencies in the components, made with TypeScript using hooks.
The npm package inversify-hooks receives a total of 511 weekly downloads. As such, inversify-hooks popularity was classified as not popular.
We found that inversify-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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.