Gathering detailed insights and metrics for inversify-hooks
Gathering detailed insights and metrics for inversify-hooks
Gathering detailed insights and metrics for inversify-hooks
Gathering detailed insights and metrics for inversify-hooks
inversify-hooks-esm
Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.
@achmadk/inversify-hooks
inversify-react-context
Simple context provider and hooks for inversify
inversify-react-addons
An additional set of hooks for inversify-react to allow for safely getting items from a container.
npm install inversify-hooks
Typescript
Module System
Node Version
NPM Version
64.2
Supply Chain
90.7
Quality
75.7
Maintenance
100
Vulnerability
100
License
TypeScript (74.73%)
JavaScript (25.27%)
Total Downloads
137,393
Last Day
173
Last Week
1,632
Last Month
5,783
Last Year
48,144
20 Stars
51 Commits
2 Forks
2 Watching
20 Branches
1 Contributors
Latest Version
2.1.6
Package Id
inversify-hooks@2.1.6
Unpacked Size
9.56 kB
Size
3.70 kB
File Count
14
NPM Version
6.14.5
Node Version
12.18.2
Cumulative downloads
Total Downloads
Last day
-61.5%
173
Compared to previous day
Last week
-7%
1,632
Compared to previous week
Last month
30.9%
5,783
Compared to previous month
Last year
32%
48,144
Compared to previous year
3
1
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, useInject } from 'inversify-hooks';
container.addSingleton<IService1>(Service1);
function ExampleComponent() {
const [service1] = useInject<IService1>(cid.IService1);
useEffect(() => {
if (!service1) {
return;
}
service1.asyncMethod();
}, [])
}
container.addSingleton<IService1>(Service1, 'MyService1');
function ExampleComponent() {
const service1 = useInject<IService1>('MyService1');
}
:warning: Important! inversify-hooks requires TypeScript >= 2.0 and the
experimentalDecorators
,emitDecoratorMetadata
,types
andlib
compilation options in yourtsconfig.json
file.
1{ 2 "compilerOptions": { 3 "target": "es5", 4 "lib": ["es6"], 5 "types": ["reflect-metadata"], 6 "module": "commonjs", 7 "moduleResolution": "node", 8 "experimentalDecorators": true, 9 "emitDecoratorMetadata": true 10 } 11}
There are more examples of how to test in inversify-props
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.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/15 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
110 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More