Skip to content

Commit

Permalink
feat: expand register add loadUnit (#251)
Browse files Browse the repository at this point in the history
<!--
Thank you for your pull request. Please review below requirements.
Bug fixes and new features should include tests and possibly benchmarks.
Contributors guide:
https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md

感谢您贡献代码。请确认下列 checklist 的完成情况。
Bug 修复和新功能必须包含测试,必要时请附上性能测试。
Contributors guide:
https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md
-->

##### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to
[x]. -->

- [ ] `npm test` passes
- [ ] tests and/or benchmarks are included
- [ ] documentation is changed or added
- [ ] commit message follows commit guidelines

##### Affected core subsystem(s)
<!-- Provide affected core subsystem(s). -->


##### Description of change
<!-- Provide a description of the change below this comment. -->

<!--
- any feature?
- close https://github.com/eggjs/egg/ISSUE_URL
-->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced registration process with the ability to include an optional
LoadUnit instance.
- **Bug Fixes**
- Improved method signatures for better clarity and functionality in
registration methods.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
akitaSummer authored Oct 21, 2024
1 parent e94c045 commit 8a1649d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugin/controller/lib/AppLoadUnitControllerHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class AppLoadUnitControllerHook implements LifecycleHook<LoadUnitLifecycl
throw new Error(`not find controller implement for ${String(proto.name)} which type is ${metadata.type}`);
}
ControllerMetadataManager.instance.addController(metadata);
await register.register(this.rootProtoManager);
await register.register(this.rootProtoManager, obj);
}
}
}
3 changes: 2 additions & 1 deletion plugin/controller/lib/ControllerRegister.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LoadUnit } from '@eggjs/tegg-metadata';
import { RootProtoManager } from './RootProtoManager';

export interface ControllerRegister {
register(rootProtoManager: RootProtoManager): Promise<void>;
register(rootProtoManager: RootProtoManager, loadUnit?: LoadUnit): Promise<void>;
}

0 comments on commit 8a1649d

Please sign in to comment.