Cordova Slack Digest

Thu, 11 Feb 2021 08:34:20 GMT

User count: 4365

Join the conversation at slack.cordova.io

Channel #random (1 messages)


Wed, 10 Feb 2021 18:13:27 GMT

@amir.jahan says

Hey everyone, if anyone is interested in Mobile App Development, particularly using Swift for iPhone, we have made our iPhone App Development Course available for the next 3 days. https://www.udemy.com/course/complete-ios-bootcamp/?couponCode=FREE_FEB_13

Channel #general (5 messages)


Wed, 10 Feb 2021 08:51:47 GMT

@sweetlulu486 says

guys, what is different cordova.js and cordova-android?

Wed, 10 Feb 2021 13:43:04 GMT

@thiel1997 says

Hello, im very new to cordova and im running into an issue. Basically i want to write an application that works on Mobile aswell as dektop. It needs to read the contents of a directory and parse all the containing xml files that get put there by the user. It should also include subdirectories. I found the plugin cordova-plugin-file wich seems like it might do the job but im not finding much usefull information on how to go about it. Nothing seems to work in Electron.

Wed, 10 Feb 2021 13:52:03 GMT

@norman137 says

I‘m not well versed in the electron environment but I don’t think many cordova plugins have an electron implementation unfortunately. I think electron will fallback to a browser implementation if a plugin has no electron implementation, but browser implementations are generally stripped back due to many limitations of the browser. Filesystem access will definitely be no exception here, since the browser implementation of the filesystem works by an isolated sandbox, so no direct access to the actual filesystem. It sounds like this is not acceptable for your use case.

So it sounds like you need to have an electron implementation that exposes NodeJS APIs to use the NodeJS fs module, which is something that doesn't exists yet as far as I know.

Wed, 10 Feb 2021 14:04:20 GMT

@thiel1997 says

Thank you for the info, seems like i have some more thinking to do.

Wed, 10 Feb 2021 14:28:32 GMT

@norman137 says

Some food for thought... if special care is taken, you may be able to have two clients and share a lot of code between the two clients... So you would have a “mobile” client powered by cordova, and an electron client (that might just use electron directly). Since both clients ultimately runs a webview, you can share a lot of UI code between them using your own common/shared library.

You‘ll need to create abstractions for some things. Such as the FS apis... so instead of calling cordova filesystem plugin, you’d have to create your own FS interface. This FS abstraction will either use cordova fs plugin if running in a cordova environment, or some other set of APIs if running in electron.

If you're familiar with OOP design principles, this would probably look a Facade[1] pattern where you can swap between the cordova FS implementation, or an electron-based FS implementation that your FS abstraction uses, depending on the client.

[1] https://en.wikipedia.org/wiki/Facade_pattern#UML_class_diagram