+1

I read through the mailing list thread and GitHub discussion, and I also
support the idea of adding promise support while maintaining the existing
callback structure for backward compatibility.

The sample "new code" presented in the GitHub discussion seems to reflect
this approach.



On Tue, Oct 15, 2024 at 12:40 AM Manuel Beck <manuelbec...@outlook.de>
wrote:

> Hi @everyone,
>
> this is a final call, that I want to start to add Promises to our
> implementation of the discontinued working draft “File API: Directories and
> System” [1].
> The rest defined by the active working draft “File API” [2], will not be
> touched. If there are no objections within the next 48 hours, then I'll
> begin work as outlined.
>
> Regards,
>
> Manuel
>
> [1] https://www.w3.org/TR/2012/WD-file-system-api-20120417/
> [2] https://www.w3.org/TR/FileAPI/
>
> Von: Norman Breau <nor...@breautek.com>
> Datum: Donnerstag, 3. Oktober 2024 um 18:42
> An: dev@cordova.apache.org <dev@cordova.apache.org>
> Betreff: Re: Promises for cordova-plugin-file
> +1
>
> The W3C standard that the file plugin currently implements is an old
> standard that has since been abandoned. There is two replacement
> standards, Filesystem[1] and Filesystem Access[2] which should be on our
> radar but it definitely will be quite a project would involve a rewrite.
> Admittedly I don't foresee that happening anytime soon.
>
> So because the current implemented standard is abandoned, I don't
> foresee any problems deviating from the standard if it means it can make
> the API less cumbersome to use. Using promises will enable the use of
> the async/await syntax as well.
>
> There are some key things I'd like to note though (and I know some of
> these were already mentioned in the GH thread but I'm re-iterating here
> for record-keeping purposes):
>
> 1. We should maintain backwards compatibility.
>
> The API should be able to accept the original method signatures using
> callbacks, in addition to, being able to return a promise that gets
> resolved/rejected appropriately. Removing callbacks method is a
> significant breaking change that we should avoid.
>
> 2. The W3C filesystem spec is large and distributed and not all parts of
> it is deprecated. For example, the FileReader, FileWriter, and File
> objects are all part of a different, still living specification and thus
> those APIs should continue to match the specification. Deviating API
> signatures on anything currently living can cause issues in the future
> with Cordova's "Cease to exists" goals. Therefore care should be taken
> to only modify the API that is part of the deprecated File API standard[3].
>
> [1]
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ffs.spec.whatwg.org%2F&data=05%7C02%7C%7Cefb74bbee82746e4648508dce3ca6993%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638635705694518661%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=qJdTFdYKV7yxCJmjvsKUT2xd1LPfuJKudXaDoovrkM0%3D&reserved=0
> <https://fs.spec.whatwg.org/>
> [2]
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwicg.github.io%2Ffile-system-access%2F&data=05%7C02%7C%7Cefb74bbee82746e4648508dce3ca6993%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638635705694539171%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=Aaagr7DXbYVBJulK98CFOhX88pROOqMONAf%2FxsQKESw%3D&reserved=0
> <https://wicg.github.io/file-system-access/>
> [3]
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.w3.org%2FTR%2F2012%2FWD-file-system-api-20120417%2F&data=05%7C02%7C%7Cefb74bbee82746e4648508dce3ca6993%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638635705694550441%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=jTUwvwpcQS9Vd9chbzPyGcvcXpg4xFeaJGD2%2F%2Bc0pUI%3D&reserved=0
> <https://www.w3.org/TR/2012/WD-file-system-api-20120417/>
>
> On 2024-10-03 09:23, Manuel Beck wrote:
> > Hi,
> >
> > I would like to add Promises to cordova-plugin-file. The goal is to get
> out of the callback hell, make the code more readable, easier to setup and
> to maintain.
> >
> > I opened an Issue for discussion on the plugin:
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fcordova-plugin-file%2Fissues%2F637&data=05%7C02%7C%7Cefb74bbee82746e4648508dce3ca6993%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638635705694561746%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=SZNQxfg%2BTzSizBFHf0f5OlKIAWc6f0DlWR9%2FAjxoRHw%3D&reserved=0
> <https://github.com/apache/cordova-plugin-file/issues/637>
> >
> > Regards,
> >
> > Manuel
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
> For additional commands, e-mail: dev-h...@cordova.apache.org
>

Reply via email to