Releases: AndrewBastin/dioc
3.0.2
This release tweaks how the dioc/vue
plugin is provided in Vue components.
For certain environments, the VUE_CONTAINER_KEY
field inside is duplicated and this causes a situation where the keys are duplicated and since they are symbols, they will always be not equal.
Now, VUE_CONTAINER_KEY
is a string directly.
3.0.1
This release is a patch release fixing a typo in the type defined in useService
composable function exposed in dioc/vue
module.
3.0.0
This release completely removes the currentContainer
mechanism and instead opted for constructor based container injection. Now, dioc doesn't keep internal state as to which service is being operated on, instead, containers pass down that info into services via the constructor of the Service
class (see changelog below for detailed code).
With this release two breaking changes are present and we recommend you update the following.
currentContainer
export is no longer available, you should dependency to it, instead use proper sources like by asking the container from a service by usingService.getContainer()
method or by using a reference to a container directly.- Service now provides a public
onServiceInit
function. This is meant to be called by containers to notify the service they are being initialised. Going forward,onServiceInit
will be where you should be putting service initialization code. Since service binds won't be guaranteed by the end of the constructor. - Service base class now takes a
Container
as an argument instead of being an empty constructor. You will have to update yoursuper
constructor calls to reflect this. Please do note that we do not recommend using constructors anymore since service binds won't be ensured during the constructor call.class TodoService extends Service { public static ID = "TODO_SERVICE" - constructor() { - super() - // init logic - } + override onServiceInit() { + // init logic + } }
- We now export
ServiceClassInstance<T>
type that defines a class constructor for aService
. This is used by functions likebind
that take service classes (rather than the instance itself) as arguments.
Full Changelog: v1.0.1...v3.0.0
2.0.0
This release fixes an issue with how references to currentContainer
are maintained. Some bundlers referenced it in a weird way causing some issues.
Full Changelog: v1.0.1...v2.0.0
1.0.1
Fixes an issue with typescript not being able to recognise the testing and vue modules defined.