Skip to content
This repository was archived by the owner on Jul 12, 2025. It is now read-only.

Commit e931c5a

Browse files
committed
docs: add information about simple object processors
1 parent c661f71 commit e931c5a

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,24 @@ class MyProcessor implements Processor {
6767
}
6868
```
6969

70-
> **Note**: Then `authenticate` method can either be synchronous or marked `async` and return a promise.
70+
Instead of implementing the processor as a class. you can also implement it has a simple object with three arrow
71+
functions attached to it, using `Processor` as the object type:
72+
73+
```typescript
74+
const myProcessor : Processor = {
75+
authenticate: (clientId : string, secret : string) : boolean => {
76+
//
77+
},
78+
checkUid: async (clientId : string, uid : Buffer) : Promise<CheckUidResult> => {
79+
//
80+
},
81+
getAudio: async (id : Buffer) : Promise<GetAudioResult> => {
82+
//
83+
},
84+
};
85+
```
86+
87+
> **Note**: The `authenticate` method can either be synchronous or marked `async` and return a promise.
7188
7289
### Running the server
7390

0 commit comments

Comments
 (0)