Check content changes of file (Javascript Web development) - javascript

I can import a file with a .PRNx extension
But I would like to detect changes in the content of the file in order to update the map.
A lot of sites tell me to use fs.watch but I am in javascript web development and not node.js.
Do you have any ideas?
Thanks

Related

How to build VSCode to be used in the browser?

I found many projects that required a server. My question how do I start Visual Studio Code like any other jQuery/React/Angular library? How do I start it from the browser without using a server?
I know that I will need to provide the files using a script.
I don't need the extension marketplace, terminal and similar. I only need the files tab on the left, the search tab, and the editor itself. The editor is Monaco, I found out. But I didn't find something that also contains the files panel and the tabs switcher (The list of opened files).
There are projects like code-server, but it requires a server. It also should be executed by our clients, so I don't want resources or security risks on the server.
So how do I compile and embed Visual Studio Code into a Web page to be served by a static HTML server?

cordova/phonegap app - load js css and html from server

I'm developing an cordova app for Android which has a lot of logic (js) and design (html/css) same as my web application. I want to share these assets among web app and android app. Now I had compiled all these js and css in apk, but when some code is changed, I have to prepare an update and put in the play store. If it would be possible to load code and css from server after app started, it would reduce need for upgrading. Is there any way?
I'm considering loading shared resources via ajax and dynamically creating stylesheets and scripts in DOM, but maybe there is better approach, isn't it?
You could download the files from server every time, but i think that is not what you want because it would not be availibe offline at all and if the app it big and the connection bad it will take much time to download.
a better way is to download the files if they change. you can do that with FileTransfer.download() yourself or use a ready solution like the cordova-standalone-hydration
BUT your app will not be accepted by for example Apple because they deny an app with code they can not check
I found a plugin where you can update all your files in the WWW folder on startup or later.
Link: https://www.npmjs.com/package/cordova-plugin-dynamic-update

Is it possible to update HTML/CSS/JS files in a PhoneGap app with out re-deploying?

If a user has installed my PhoneGap app is there any way to update the static files such as the HTML or CSS with out the need to re-deploy the app again?
For example, when updating a web app, the developer can make a change to a CSS file on the server, and on the next page refresh the style change will be visible to the user.
I'm assuming being able to do this is unlikely due to the app needing to be packaged up and installed on the device, but I'm looking for some verification.
You could change the app to import the file externally from a server (something like <link rel="https://linktofile.com/file.css">, which means you can change the app's style at any time without re-compiling the app.
Otherwise I am not aware of any other way.
#Stavros_S
delopying a website as is suggested by Praveen Kumar is NOT best practice for mobile Apps.
Recently, Google created a new means to do what you want. It is called an Expansion File. Read this:
https://iphonedevlog.wordpress.com/2014/12/12/adding-an-android-apk-expansion-file-to-a-cordova-project/

Save Javascript or Replace Javascript File in Chrome Developer Tools

Is there a way to replace a .js file in the website sources with a file on my workstation, or make a modification to a .js file and refresh the website to see the changes?
I am developing client-side JavaScript code against a SharePoint website on a server. I cannot create a local version of the website, so I need to modify the script, save the file to the server, refresh, etc. I do not have direct access to the server, and saving a file in a SP doc library or web part takes a lot of time between edits.
I can make small modifications using the dev tools while breaking on certain lines and applying snippets, but I am hoping for a better way.
Thanks!
If you have access the server that's hosting the file you should be able to replace or modify the JS file. Alternately you can use local hosting tools to test your file and then upload it to the server once you've confirmed it's working.
If you explain what you level of access to your host is we can offer better suggestions.

Is it possible to make this page an offline web app to the iPhone?

www.mark??z.se/test
Remove the: ??
It is only 4 files:
index.html
appIcon.png
startup.PNG
SMS_2.jpg
How can i make this to an offline app, is it possible?
The CSS and all JS are in the html file.
Read about creating offline web apps here:
http://diveintohtml5.ep.io/offline.html
The iPhone Safari browser supports offline web apps. You need to:
modify the webpage to reference a cache.manifest file
create a cache.manifest file listing the resources that need to be downloaded
configure your web server to serve the cache.manifest file with the proper content type
I used this reference (among others) to create an offline GWT web app. iPhone/Safari can "bookmark" the website by using "Add to Home Screen" so it looks like an iphone native app.
Good luck.
The UIWebView
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html
is capable of displaying html content that has javascript and css associated with it. I should be possible to include your files as part of the app's bundle and have the UIWebView load them. Have a read through that class reference and sample code to see if it suits your needs.
in a desktop pc, be shure every resource is boundled with the html file, css inlines, js inlines, images encoded in css via url('data:image')
#see http://en.wikipedia.org/wiki/Data_URI_scheme
and associate a browser to html files, doubleclick on the page will open your page.
also chrome has a "create application shortcut" that will make an even more "native" frame around your html5 app.
prism https://wiki.mozilla.org/Prism is the same concept implemented with mozilla engine.
in mobile browsers based on webkit there are similar means to exploit, i.e. for iPad you can create shortcuts in the home screen that will look exactly like a native application and access a 5Mb of file cache(http://www.html5rocks.com/tutorials/appcache/beginner/).

Categories

Resources