-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add extension storage #2069
Add extension storage #2069
Conversation
requestAnimationFrame(() => { | ||
requestAnimationFrame(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@philippkuehn is there a reason why we need to call requestAnimationFrame
within a requestAnimationFrame
? Why is 1 requestAnimationFrame
not sufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I always do a double RAF because of this. Maybe it’s not needed here. Is there any issue with that?
At some point you probably want to save some data within your extension instance or want to provide some methods that are accessible outside of the extension. With this PR it’s possible now.
The stored data is mutable. You can access it within the extension under
this.storage
.When using Vue or React, this storage is reactive within your templates.
Outside the extension you have access via
editor.storage
. Make sure that each extension has a unique name.When using TypeScript you can define a type for your storage.
Global storage types can’t be inferred so you have to give a hint: