Cordova Slack Digest

Sat, 15 Aug 2020 08:21:24 GMT

User count: 4064

Join the conversation at slack.cordova.io

Channel #general (21 messages)


Fri, 14 Aug 2020 15:10:37 GMT

@osaintilien55 says

Using javascript how can I get data from HTML files that are not on the DOM. For example when I use document.querySelector it only queries the active HTML file, but I want to be able to get info from other html files elements that are not active. I hope I am being clear.

Fri, 14 Aug 2020 15:28:04 GMT

@chris551 says

@osaintilien55 I'm pretty sure you cannot access the DOM of an unloaded file

Fri, 14 Aug 2020 15:30:38 GMT

@erisu says

Might be able to load it in an iframe and then access the content of the iframe…

Fri, 14 Aug 2020 15:30:45 GMT

@erisu says

but it must be loaded first

Fri, 14 Aug 2020 15:30:56 GMT

@chris551 says

I need to know, if its possible to configure my Cordova app to “start” in a JS file, rather than a HTML file. I need to check if the user is “logged in” before deciding which screen to show. I'm converting an Electron NodeJS app to Cordova, hence my question.

Fri, 14 Aug 2020 15:38:28 GMT

@erisu says

I know its possible to change start urls but from a quick test it does nothing if it was a JS file

Fri, 14 Aug 2020 15:39:14 GMT

@erisu says

Normally you would have an SPA that when the index.html loads it has nothing really but the 1 js entry file

Fri, 14 Aug 2020 15:39:23 GMT

@erisu says

and then the file would decide what page to render..

Fri, 14 Aug 2020 15:39:46 GMT

@chris551 says

don't suppose you have example anywhere?

Fri, 14 Aug 2020 15:39:58 GMT

@osaintilien55 says

Hmm okay, to give you some insight to the situation. I am making a library type of app and for the search function I am placing all the text of the books inside of one object in a js file which will be used as the index for the search function, which will return a list of clickable results that would redirect the user to the HTML file of the actual book and page. At this rate I would have two copies of the entire library in the app, one in the javascript file and then the actual HTML file of each book. And so I was thinking it would be better if I could just grab the text data from the various HTML files of each book and use that inside of my javascript object to save on space and redundancy. But I guess that is not possible right?

Fri, 14 Aug 2020 15:41:59 GMT

@chris551 says

Like I said before, I'm new to Cordova however usually I would recommend you have the content in a database and search/load from that. You are absolutely right in that you do not want two copies of the data. There maybe a possibility you can search the text file though

Fri, 14 Aug 2020 15:44:44 GMT

@erisu says

that type of data is JSON so you could turn it into JSON file and then fetch it with XHR

Fri, 14 Aug 2020 15:46:12 GMT

@erisu says

I dont have an example Chris but maybe I can try and mock something quickly for the SPA example…

Fri, 14 Aug 2020 15:47:59 GMT

@chris551 says

If you wouldn't mind, that would totally smashing, thanks

Fri, 14 Aug 2020 15:48:07 GMT

@chris551 says

Very quick and dirty

Fri, 14 Aug 2020 15:49:13 GMT

@osaintilien55 says

Got it okay thank you, I am fairly new to all of this too including JavaScript, However I think if I use a database that would mean users would need internet for the search to work, right? Currently the way it is now, the search can work without internet connection which is a big plus. Since I want the app to work offline I guess databases would be out of the question right?

Fri, 14 Aug 2020 15:53:11 GMT

@erisu says

The app could have an IndexedDB setup. So when you launch the app check if IndexedDB is created if not then populate it.. The data though would have to reside in the first entry file I guess. And if you switch pages, they all should be able to query the IndexedDB

You could also install SQLite plugin I suppose..

Fri, 14 Aug 2020 15:54:46 GMT

@erisu says

Another option could be that internet is required on the initial start and it can download the data it needs and store it locally in the IndexedDB or SQLite DB of the app..

Fri, 14 Aug 2020 15:55:30 GMT

@erisu says

But the data source of truth is always from the database on your server.. so if they ever connect to the internet, it could at that time when app is launched to try and fetch and sync the data for more stuff.

Fri, 14 Aug 2020 15:56:00 GMT

@erisu says

but while offline use old data..

Fri, 14 Aug 2020 15:57:00 GMT

@osaintilien55 says

Big Thanks I will look into the implications of all this and how the technologies work IndexedDB and SQLite to be exact

Channel #cordova-android (1 messages)


Fri, 14 Aug 2020 14:56:38 GMT

@nepmontanez says

Hi guys, does anyone had the same issue occurred when you tried to run the latest cli in making apk release with targetSDKVersion=29. Thank you!