Storing Data
As a Plugin author you may want to store some data that your Plugin can use the next time it opens. There are three options for storing data:
Storing global data on a project level
Storing data on a specific node
Storing user specific data on the client
Important: Don’t use this API to store sensitive data such as secret keys or access tokens.
Storing global project data
You may want to store data at the project level that is shared between users. There are API methods available on the framer
export for this.
Note: A data entry only supports strings and can contain a maximum of 2kB
per entry, with a total of 4kB
. If you exceed this limit, the setPluginData
method will throw. It is still possible to delete plugin data.
Storing data on a node
If your Plugin works on the canvas, you may want to store some data on a specific node. For example, a flag to indicate that your Plugin previously interacted with this Node, or some other metadata to render UI.
Every Node supports the same storage API methods for storing plugin data. The Collection instance also supports these methods.
Note: A data entry only supports strings and can contain a maximum of
2kB
per entry on a Node, with a total of4kB
per Node. If you exceed this limit, thesetPluginData
method will throw. It is still possible to delete plugin data.
Removing data
Both project and node data can be deleted by setting the data value to null
. This will automatically remove the key.
Storing user specific data on the Client
Some things, such as user preferences or authentication tokens should not be stored on the project but be specific to each user. For these things you can use the built-in localStorage
and sessionStorage
APIs. Plugins run in a sandboxed iframe on a unique origin and will not be able to read each others data when you use these storage APIs