New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cordis

Package Overview
Dependencies
Maintainers
1
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordis - npm Package Compare versions

Comparing version 2.8.1 to 2.8.2

2

package.json
{
"name": "cordis",
"description": "AOP Framework for Modern JavaScript Applications",
"version": "2.8.1",
"version": "2.8.2",
"sideEffects": false,

@@ -6,0 +6,0 @@ "main": "lib/index.cjs",

@@ -31,3 +31,3 @@ # Cordis

- [Unload a plugin](#unload-a-plugin-)
- [Clean up side effects](#clean-up-side-effects-)
- [Clear side effects](#clear-side-effects-)
- [Reusable plugins](#reusable-plugins-)

@@ -61,3 +61,3 @@ - [Service](#service-)

To add an event listener, simply use `ctx.on()`, which is similar to the `EventEmitter` that comes with Node.js: the first parameter incidates the name of the event and the second parameter is the callback function. We also support similar methods `ctx.once()`, which is used to listen to events only once, and `ctx.off()`, which is used to cancel as event listeners.
To add an event listener, simply use `ctx.on()`, which is similar to the `EventEmitter` that comes with Node.js: the first parameter indicates the name of the event and the second parameter is the callback function. We also support similar methods `ctx.once()`, which is used to listen to events only once, and `ctx.off()`, which is used to cancel as event listeners.

@@ -81,3 +81,3 @@ ```ts

In cordis, triggering an event can take many forms. Currently we support four methods with some differences between them:
In cordis, triggering an event can take many forms. Currently, we support four methods with some differences between them:

@@ -124,5 +124,5 @@ - emit: calling all listeners at the same time

- `dispose`: triggered when the context is unloaded
- `fork`: trigged every time when the plugin is loaded
- `fork`: triggered every time when the plugin is loaded
The `ready` event is triggered when the application starts. If a `ready` listener is registered in a application that has already started, it will be called immediately. Below is an example:
The `ready` event is triggered when the application starts. If a `ready` listener is registered in an application that has already started, it will be called immediately. Below is an example:

@@ -151,3 +151,3 @@ ```ts

- contains asynchronous operations (for example IO-intensive tasks)
- should be called after other plugins are ready (for exmaple performance checks)
- should be called after other plugins are ready (for example performance checks)

@@ -160,7 +160,7 @@ We will talk about `dispose` and `fork` events in the next section.

- a function that accepts two parameters, of which the first is the plugin context, and the second is the provided opions
- a function that accepts two parameters, of which the first is the plugin context, and the second is the provided options
- a class that accepts above parameters
- an object with an `apply` method in the form of the above function
When a plugin is loaded, it is basically equivalent to calling the above function or class. Therefore, the following four ways of adding a event listener is basically equivalent:
When a plugin is loaded, it is basically equivalent to calling the above function or class. Therefore, the following four ways of adding an event listener is basically equivalent:

@@ -229,3 +229,3 @@ ```ts

Some plugins can be loaded multiple times. To unload every forks of a plugin without access to the `ForkScope` instance, we can use `ctx.registry`:
Some plugins can be loaded multiple times. To unload every fork of a plugin without access to the `ForkScope` instance, we can use `ctx.registry`:

@@ -238,5 +238,5 @@ ```ts

#### Clean up side effects [↑](#contents)
#### Clear side effects [↑](#contents)
The `dispose` event is triggered when the context is unloaded. It can be used to clean up plugins' side effects.
The `dispose` event is triggered when the context is unloaded. It can be used to clean up plugins' side effects.

@@ -288,3 +288,3 @@ Most of the built-in methods of `Context` are already implemented to be disposable (including `ctx.on()` and `ctx.plugin()`), so you do not need to handle these side effects manually. However, if some side effects are introduced by other means, a `dispose` listener is necessary.

Note that the `fork` listener itself is a plugin function. You can also listen to `dispose` event inside `fork` listeners, which serves a different purpose: the inner `dispose` listener is called when the fork is unloaded, while the outer `dispose` listener is called when the whole plugin is unloaded (either via `ctx.registry.delete()` or when all forks are unloaded).
Note that the `fork` listener itself is a plugin function. You can also listen to `dispose` event inside `fork` listeners, which serves a different purpose: the inner `dispose` listener is called when the fork is unloaded, while the outer `dispose` listener is called when the whole plugin is unloaded (either via `ctx.registry.delete()` or when unloaded all forks).

@@ -702,3 +702,3 @@ ```ts

`EffectScope` can be accessed via `ctx.scope` or passed in in some events.
`EffectScope` can be accessed via `ctx.scope` or passed-in in some events.

@@ -737,3 +737,3 @@ #### scope.uid

It can be accessed via `ctx.scope.main` or passed in in some events.
It can be accessed via `ctx.scope.main` or passed-in in some events.

@@ -754,3 +754,3 @@ #### runtime.name

The `ready` event is triggered when the application starts. If a `ready` listener is registered in a application that has already started, it will be called immediately.
The `ready` event is triggered when the application starts. If a `ready` listener is registered in an application that has already started, it will be called immediately.

@@ -763,3 +763,3 @@ See: [Application lifecycle](#application-lifecycle-)

See: [Clean up side effects](#clean-up-side-effects-)
See: [Clear side effects](#clear-side-effects-)

@@ -766,0 +766,0 @@ #### fork(ctx, config)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc