using JQuery fileTree for Apache Cordova application - javascript

I am trying to use this File Tree For my Apache Cordova Application.
As it cannot contain any server side scripts, the script must be placed into a seperate project and be called from the client side (apache cordova app).
So that means I need to call the script with Ajax jquery and display the files.
How do I do it using this JqueryFile browser JQuery fileTree?

I can suggest 2 approaches.
1) Use Cordova File api to get a list of directories/files to render a file tree in your JS application(i.e. Populate jQuery file tree)
http://docs.phonegap.com/en/edge/cordova_file_file.md.html#DirectoryReader
2) I have not used this plugin myself, but you can use a Cordova plugin like below to access the native file system:
Cordova Plugin File
You can not run a JavaScript library on the native side, you'd need to write code in ObjectiveC/Swift for iOS or Java for Android and create a plugin like above.

Related

Browser like experience on a .Net Server

I want to generate a leaflet map on a .Net server. Currently am aware that this i only possible on the browser. I want it server server side so that i can re-generate automatically later and export it to various formats for a report
Are there tools that I can integrate with my .Net project to give
me a browser like experience on the server
I found the solution to server side rendering of js and css on DOM files with chromium.
Chrome can be run as headless providing the capability to render in the backend without it's UI. There's a library than can be used to drive chromium call peppetteer for Node js
and PuppeteerSharp for .Net. Under .Net u can get it as Nuget Package and as for Node js its on npm .
https://github.com/kblok/puppeteer-sharp for PuppeteerSharp

JXCore Cordova => Native Cordova Plugin (can't reach cordova.exec(...))

I'm using the JXCore Cordova Plugin to get my Node.js Application running on mobile devices. I also wrote a native cordova plugin, to process some tasks in native part of the application.
But I can't reach the native cordova plugin. Is this the right approach to do this?
1. Register method from UI to jxcore instance (index.js): jxcore('someNativeExtension').register(someTriggerMethod);
(where the trigger does something like cordova.exec(...);)
2. Start Node (index.js): jxcore('app.js').loadMainFile(callback);
(after this step I move to another index.html, that is served by express.js:
=> window.open('http://localhost:8080/apps/backend/index.html','_blank');)
3. Call method from Node (app.js): Mobile('someNativeExtension').call();
But this snippet doesn't work, because it seems, that cordova.js isn't present, after I receive another html file. Do you have Any Idea, how to fix this?
When you browse another URL, cordova client side files are not loaded with that URL. Since you have the control for the loaded HTML page, that page can load cordova + jxcore JS files

Phonegap clients using MEAN angularjs Nodejs Stack

I am developing Web Application using MEAN(Mongo, Express, Angular, Node) JS stack.
I would like to use PhoneGap to compile my clients for Android/iphone native app. At the same time I want to keep same client-side Views & AngularJS code to remain usable for desktop browsers. I am using bootstrapper for Responsive design and it works fine for me on mobile browsers.
I saw, Phonegap require us to include some of it's own Javascript files, and I will be required to have few more .js files in footer of index.html.
If I pressume, I should not be using server side .jade engine for index.html file, and all my .html should remain in client side.
will index.html created for phoneGap will cause problem, if I use it for desktop browser? Should I have different index.html for browser and phoneGap input. Can grunt help me in customizing index.html files.
What are the other things which I should take care of for my needs?
My advice for you is to separate the projects, Phonegap or Cordova Apps doesn't have a running server, they serve the html files through the file:// protocol.
If I pressume, I should not be using server side .jade engine for
index.html file, and all my .html should remain in client side.
You presumed correctly, no .jade templates should be used, your views should be plain html files or, if you want, load them as scripts so you don't have to load them on page request increasing app performance.
will index.html created for phoneGap will cause problem, if I use it
for desktop browser? Should I have different index.html for browser
and phoneGap input. Can grunt help me in customizing index.html files.
Yes it will, if you try to use an index,html from phonegap on a desktop browser you will get a lot of javascript alerts. Since phonegap.js is expecting to get some events that are fired by cordova when running on the device. And this gets worse if you have Cordova plugins.

how to implement phonegap plugins in external JS file?

I have a Phonegap app, that would open an external URL with super.loadUrl("http://example.com/index.html")
On that page I have included some Javascript code for a Phonegap Plugin. Is it possible to call a plugin from external Javascript file? I don't see why shouldn't work, but it doesn't.
My plugin is FileTransfer plugin. When I run the app with a local index.html all works fine, but I need to run an external script which calls the FileTransfer plugin. Is that possible? Does anybody tried it before ?
I asked in the Phonegap IRC and they say NO. Of course this could be a big security threat.
I also asked if it would be possible to include internal JS scripts in my external HTML file. And the answer is also NO. The best way is to turn the web app into an native app, and have all the scripts locally.

How to deploy WaveMaker project without runtimeLoader.js

WaveMaker is a powerful ajax based UI builder, but its JSON-RPC API standard is incompatible with our web service, which only has a RESTful API. As a result, we would like to design an UI without using any service using WaveMaker, and only extract part of its source code that runs on browser side (discarding all services)
Unfortunately, we can neither view or test the extracted code (all .html files show an empty page), a javascript reference in index.html is pointing to runtimeLoader.js, which we cannot find anywhere. So, is it possible to deploy the browser side code on a web container (not an application container like Tomcat) without runtimeLoader.js? If this is not possible, how do I change the source code so it can be tested without using WaveMaker?
If you don't mind having a java server in the mix, you could "import" REST calls to your API into the application. The XHR service (new in 6.5) targets JSON returning services. The 'Build-a-Service' does best with XML returning services. The browser would then call the WM java server, which in turn calls your REST services.
An easy way to get started with a WaveMaker client only app is to use the phonegap build option. This will build a zip file of a stand alone app. If you unzip that into say an apache served folder, you will render pages, etc. Note this build is targeted towards mobile devices via phonegap, so you will want to make adjustments if you are targeting desktop browsers.
Also, runtimeLoader.js can be found in the client runtime lib folder. e.g. /studio/lib/runtimeLoader.js of the installation.

Categories

Resources