Issue #2315đź’¬ AnsweredOpened October 7, 2019by tom-sherman1 reactions

Allow returning promises from StorageManager `.load` and `.store` methods

Quick answerby tom-sherman❤ 1

Thanks for your thoughts! Hopefully I'll have time to implement it this week

Read full answer below ↓

Question

This would offer a more modern and clean API than the current callback based approach. Proposed API: --- There are a few ways this could be implemented:Detect if the load/save method is thenable, if so await This would complicate the API and code a little as users would need to make a choice between using either the callback or Promise based approach. The upside to this though is that it would not be a breaking change. A side effect of this API change would allow mixing and matching of approaches:Switch to a Promise only StorageManager API The big benefit of this is we would be encouraging a...

Answers (3)

tom-sherman• October 17, 2019

Thanks for your thoughts! Hopefully I'll have time to implement it this week

artf• October 17, 2019

Really cool feature request Tom, I'd totally appreciate a PR. For sure I'd go with your first approach, not breaking the current API is always a goal to reach. Just adding the ability to create async-await enabled custom storage managers would be amazing. Later we might also update the built-in loc...

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.