Skip to content

How to define capsules declared in another package? #85

Closed Answered by GregoryConrad
busslina asked this question in Q&A
Discussion options

You must be logged in to vote

In the package library I define an abstract (or mixin) App entity that must be implemented/extended on the project.

That goes against ReArch quite a bit (using inheritance). You should instead expose capsules in your library package that declare a certain API to be defined elsewhere so that you can then use those common capsules in your library package.

There are two ways I can think of to do this off the top of my head.

  1. (Not preferred) Use a singleton/static instance that allows you to set the current implementation of some capsule.
  2. (Preferred) Make your library package's capsules act as "proxies" that route all requests to another capsule. Here's an example:
// In your library package:

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@GregoryConrad
Comment options

@busslina
Comment options

Answer selected by busslina
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants