How to use the inversify.METADATA_KEY.PARAM_TYPES function in inversify

To help you get started, we’ve selected a few inversify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stkevintan / ServiceX / src / ioc / inject.ts View on Github external
export const Injectable = >>() => (target: T): any => {
  injectable()(target)
  const parameters = Reflect.getMetadata(METADATA_KEY.PARAM_TYPES, target)
  for (let index = 0; index < parameters.length; index++) {
    const parameter = parameters[index]
    // only auto inject service
    injectService(parameter, target, undefined, index)
  }
}
github inversify / inversify-binding-decorators / src / syntax / provide_done_syntax.ts View on Github external
return function (target: any) {

            const isAlreadyDecorated = Reflect.hasOwnMetadata(inversify_METADATA_KEY.PARAM_TYPES, target);
            const redecorateWithInject = force === true;

            if (redecorateWithInject === true && isAlreadyDecorated === false) {
                decorate(injectable(), target);
            } else if (redecorateWithInject === true && isAlreadyDecorated === true) {
                // Do nothing
            } else {
                try {
                    decorate(injectable(), target);
                } catch (e) {
                    throw new Error(
                        "Cannot apply @fluentProvide decorator multiple times but is has been used " +
                        `multiple times in ${target.name} ` +
                        "Please use done(true) if you are trying to declare multiple bindings!"
                    );
                }
github project-flogo / flogo-web / apps / server / src / injector / plugin-injection / resource-registrar.ts View on Github external
function isInjectable(target) {
  return (Reflect as any).hasOwnMetadata(METADATA_KEY.PARAM_TYPES, target);
}
github vscode-icons / vscode-icons / src / services / compositionRootService.ts View on Github external
.forEach(klass => {
        Reflect.deleteMetadata(METADATA_KEY.PARAM_TYPES, klass);
        Reflect.deleteMetadata(METADATA_KEY.TAGGED, klass);
      });
  }