Closed srsudar closed 6 years ago
It is expected. The code of this library is very simple. It adds a callback to every function and returns a promise. It is intended to be used only with functions that have a callback.
If there was a way to detect which functions have callbacks at runtime, it should be possible to fix this. But I don't think there's a way to do it.
The only way to do this is to add the chrome api to the repo and then keep it up to date. The then-chrome library seems to have something like this, but it doesn't support the fileSystem api.
I will try to find a way to solve this. But first I need to resolve the other open issues.
Ah great. I'm able to work around it pretty easily by overwriting the method that I need with the default method.
I think this is acceptable behavior, even if it's not ideal. If you mentioned in the the README
that callers need to use the bare chrome.*
APIs that don't have callbacks, I think it is perfectly fine.
I'm going to leave this open so that you can decide how you want to proceed, but as a user I'd be fine with just noting this in the documentation.
Yeah, I will add a warning to the readme tomorrow.
It would be great if this library can be a total replacement of chrome
, so I will leave this open for now.
Closing this issue as there's currently no way to know if a method receives a callback or not.
Unfortunate but seems reasonable, especially with the update to the README. Your example of using chrome
/chromep
is nice and clean.
The
chrome.fileSystem.retainEntry()
API does not take a callback. I am seeingchromep
fail when calling this method, as Chrome appears to be doing some schema checking. I can't find anything about where this happens, and I should be able to work around it, but it seems likechromep
should be aware of this.E.g. consider this code:
At this point I would expect
id
to be a string. Instead it is a rejected Promise. From the console:Is this expected? Is it something else about my environment that is interfering with things? Or perhaps a bug?