KeithHenry / chromeExtensionAsync

Promise wrapper for the Chrome extension API so that it can be used with async/await rather than callbacks
MIT License
228 stars 32 forks source link

Remove non-standard `contextMenus.create` #26

Closed dlh3 closed 4 years ago

dlh3 commented 4 years ago

The await keyword will work fine with the create function's return (without a Promise), so by skipping the Promisification of this function, it will work in more cases, namely when used with async/await.

Unfortunately, this won't work with promise chaining (using then()), but that can be managed by wrapping the function with Promise.resolve() (eg, Promise.resolve(chrome.contextMenus.create(props)).then(console.log)). I have another idea about how that could also be tackled... I'll open a separate PR in a bit.

Fixes #23.

KeithHenry commented 4 years ago

@dlh3 Nice one, I think this is the simplest way to resolve #23.

dlh3 commented 4 years ago

Happy to help.