mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
27 lines
572 B
Markdown
27 lines
572 B
Markdown
|
# Adapter Manager
|
||
|
|
||
|
A manager for retrieving custom "adapters" - can be used to abstract away from custom implementations
|
||
|
|
||
|
## Usage
|
||
|
|
||
|
```js
|
||
|
const AdapterManager = require('@tryghost/adapter-manager');
|
||
|
|
||
|
const adapterManager = new AdapterManager({
|
||
|
pathsToAdapters: [
|
||
|
'/path/to/custom/adapters',
|
||
|
'/path/to/default/adapters'
|
||
|
]
|
||
|
});
|
||
|
|
||
|
class MailAdapterBase {
|
||
|
someMethod() {}
|
||
|
}
|
||
|
|
||
|
adapterManager.register('mail', MailAdapterBase);
|
||
|
|
||
|
const mailAdapterInstance = adapterManager.getAdapter('mail', 'direct', mailConfig);
|
||
|
|
||
|
mailAdapterInstance.someMethod();
|
||
|
```
|