Support for extending or customising the runtime? #50
-
Is this planned/possible to support? Some use cases I'm thinking of:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Much of that will fall under the category of new feature development and we will be handling that very carefully. The best approach is to open a discussion or issue early to propose and discuss possible features before writing any code. |
Beta Was this translation helpful? Give feedback.
-
@jasnell Ah, I was more thinking like |
Beta Was this translation helpful? Give feedback.
-
For things like a KV API with a different backing, that's supported out of the box! |
Beta Was this translation helpful? Give feedback.
-
Hi Tom, The code today is structured internally so that it's possible to add custom APIs and event handlers. Specifically, the full set of available APIs is controlled by the class HOWEVER, we do not currently make any promises about stability of internal APIs. E.g. We might add a more flexible mechanism for custom APIs in the future, perhaps especially to support Workers for Platforms use cases, but this is something we need to design carefully in coordination with our product management team. (I'm converting this issue to a discussion since I don't think there's an action item for us, but happy to answer questions about this.) |
Beta Was this translation helpful? Give feedback.
Hi Tom,
The code today is structured internally so that it's possible to add custom APIs and event handlers. Specifically, the full set of available APIs is controlled by the class
WorkerdApiIsolate
insrc/workerd/server/workerd-api.{h,c++}
. Essentially, if you fork theserver
directory, you can add new APIs here without having to fork the rest of the codebase.HOWEVER, we do not currently make any promises about stability of internal APIs. E.g.
WorkerdApiIsolate
implements theWorker::ApiIsolate
interface. This interface could change at any time. You will have to be ready to update your code as needed, or be willing to pin to a particular version of workerd.We might add a more flexible …