Preloading Ext JS & custom JavaScript files at application boot time - javascript

I'm creating an intranet application, the UI of which premoninently uses Ext JS 4.1.1
I have created several custom javascript classes extending Ext JS controls and other code for UI, validation, communication, etc.
Given that my code is not very huge and that my application will be deployed in a controlled & well known environment I'd ideally like to load all .js files upfront at the time of application invokation (boot). I'd like to know an approach to achieve this, mostly from within the relm of Ext JS.

What you want to do is something really usual. Take a look at the deployment section to know how to use the Sencha SDK to create one file containing all your custom javascript classes which extend extjs component here
I hope it is useful ;)

As of this month Sencha (beta) released a revamped build tool. Actually, it is a complete rewrite in Java (I believe). Sencha Cmd is the name, and it is all that the predecessor should have been!
Compile times have been crunched to maybe a 10th of its predecessor and packages/builds are now configured using a powerful command processor.
Integration into other build frameworks and CI servers is now a top priority and achieved by integrating the tool with ANT.
I just spent the past hours to migrate a project from the old Sencha SDK Tools to the new Sencha Cmd. I particularly love the new compiler.
Documentation is already pretty good.
Blog post that introduced Sencha Cmd
Official SDK documentation - there is a total of 10 articles on the subject, don't miss them, particularly the
Compiler documentation
For smaller projects that follow the standard (single-page) pattern suggested by Sencha, there is actually a range of higher-level commands that manage the entire application creation and build process.
Furthermore, Sencha has now a pattern in place for multi-page applications.
And you can always use the compiler directly and implement your own build process on top of it. That's what we did in our project.

There is one class called Ext.Loader

This is more of a server-side question than an Ext JS question. You want to include all your pages up-front? Get a JavaScript compressor to concatenate your files together, minify the whole pack, and add a <script> tag to every page in your web app.
I also work on an intranet web app that heavily uses Ext JS (both 3 and 4), but we have quite a large codebase. Since we use Tomcat, we have a Java class that includes standard files on each page, plus any file groups or individual files we need for that page. Something like that might work for you as well.
You can use Ext.Loader for dynamic loading when you need it, but that doesn't sounds like what you're looking for. Still an option though, should your codebase expand and you need a better solution.
EDIT: As mentioned in the comments, my original answer failed to address the Sencha SDK Tools. I felt it would be more beneficial to make my response part of my revised answer.
While this task may be exactly what the Sencha SDK was designed for, I feel that the product is not yet mature enough for production environments. At the time of writing, the current version is 2.0.0 Beta 3. Beta, meaning it's still under development, and it shows. Documentation is practically non-existent and the official forums are full of topics claiming the product simply does not work. At this point, it's nothing more than a toy to be played with. The most helpful document I've seen is Sencha SDK Tools 2.0 and ExtJS4: The Missing Docs, and the author even ends with "The SDK Tools need a lot of work."
When I'm choosing a product for a production environment, I want something stable, something reliable, something with good documentation, something with quality support. The Sencha SDK Tools are none of those things. Yet.

Related

What framework to use in order to build web components: lit-element vs stencil vs SkateJS?

I want to start leveraging http://webcomponents.me W3C standard which is now supported by all major web browsers.
I researched the internet and so far I found following frameworks:
Stencil - Created by ionic. All ionic components use this framework/compiler in order to build native supported web components.
lit-element - Created by Google and is part of Polymer framework.
SkateJS - Don't know how is behind this but it is in top 3 popular web components framework.
Can someone give me advice or opinion which framework is best?
If you want to build:
Fast
Easy-to-debug
Cross-browser
Framework-agnostic
web components you could also consider using framework :
http://vanilla-js.com/
As I've been working with native vanilla JS web components for the past 4.5 years as my main subject, I would like to add my opinion as a seasoned web developer with almost 30 years of experience.
As with all development tooling, these tools share a common problem. Either they
evolve - forcing you into an undesirable update loop, keeping you busy with stuff that's long-finished just to keep the tooling fresh and secure,
or they just "die" - check SkateJS e.g. The last commit on that repo is now 3 years old and open issues from 2019 exist that haven't even been commented on. The latest release is from 2017!!
This is not only true for authoring tools like the three suggestions you mentioned - this is also true for the whole build stack tooling.
Last year I took a dive to see what kind of modern build tools would be nice to work with for authoring web component libs. When doing the research, I stumbled upon Snowpack and Vite.js. We started out with Snowpack, but at the time it still seemed to have a number of stability issues, so we decided to switch to Vite.js. Last week I decided to give Snowpack another shot, only to find it deprecated in favor of Vite.js:
Stuff like this happens way too often, and while tooling should help you get stuff done faster and better, more often than not you find yourself dealing with the shortcomings of the tooling, incompatibilities with addons when updating the main library, security issues... rather than focussing on doing your business coding.
This is also true for popular tools like Storybook.
Once you start relying only on ECMAScript itself, and the browser API, you'll learn that most things like e.g. routing for SPAs are quite easy to develop yourself.
You probably won't need a build stack any more very soon. We have widespread support for HTTP/2, making bundling undesirable anyway, so just work with native ES modules. Not using a build tool and not bundling also has the huge benefit of not having to generate and rely on maps any more; let alone the fact that it immensely improves the development experience by keeping turnaround times in no-matter-how-complex projects in the ms realm. Code-you-write-is-code-that-runs - how amazing is that? No third-party-black boxes when your debugging leads you into code that would take you years to understand.
Instead of CSS preprocessors, work with native CSS and custom properties - native CSS nesting is coming to browsers as well.
To go fully build-less, there's unfortunately still some bits and pieces missing, but those are in progress. The most important ones are:
CSS Module Scripts <- We have these now. HURRAY :)
HTML modules
JSON modules (Stage 3)
Some libraries are already picking up on this, e.g. ficus.js.

Can I use EmberJS or other frameworks without gettting its server up?

I want a javascript framework which has features like below:
MV*
Well structured
Html file as template
Rendering fast(maybe virtual dom?)
Combine and compatible with other plugins or libraries
Edit on tablet IDE apps and view in browser immediately by refreshing page after I changed code
When I am at home, I use PC to develop my client-side(or front-end) applications.
When go out, I use my tablet(I have no note PC), so I want to develop my applications outside.
*There are some excellent IDE apps on the Android Market.
Before I know Ember, I have been using pure javascript(jquery) + css + html to develop client-side application for daily practices or work.
But recently, when I began to learn EmberJS, a Javascript MVC framwork, I am lost.
It seems that EmberJS have to get its own server up to compile something, which generate static contents for browser rendering.
I just want to get my client-side code(files) rendering in the browser, but why I have to 'run' it as if I get apache started to serve as a php back-end.
I have googled hundreds of pages to find a solution, nothing expected result discovered.
Including Angular, backbone or any other popular Javascript MV* frameworks, they all must compile there applications.
Is there anyone who has encountered this situation?
Then any advice, please?
Increasingly most Javascript frameworks are shifting to doing a "compile step" as part of using them. This allows you to do a variety of changes to your Javascript files, which in turn makes it easier for you as a developer. An example of this is that you can use ES2015 classes and then have your compile step "transpile" them to older Javascript that will work in all browsers.
The side effect of this though is that you need to have npm running on your computer to be able to do this well.
If you really don't want to have the compile step, then I would suggest looking at VueJS. It's the only recent Javascript framework that allows working with simple non-compiled JS files. But you'all be missing out on some of the best changes to Javascript as a result (ES2015 has made life much better)
Finally, I found a nice solution(framework) that is Durandal.
Really, pure HTML+Javascript without built and server up(anyhow, a web server needed if I wanted to publish it in my hosted web server).
.html extension and designer friendly.
I can upload its source files directly in to S3 and browse the html pages.
Just found some nice examples with well structured project on github is here.
And I can work smoothly with my dear designer friends.
Though its next generation Aurelia will also be built and serve it up like Ember or others, but the current generation is enough for me.
Hope those one got help from this;)

New to PhoneGap, need guidance to get started

Ok, I've been in planning for developing a PhoneGap app for a few months, and it's come time for me to start coding. There are a few things I am confused about that I need to clear up before I can get going, because things don't seem to be going well.
To begin, I am using PhoneGap to build this app because I plan to release it to multiple platforms (primarily iOS and Android) and based on the tutorials for Objective-C that I've read, I'd much rather use JavaScript/jQuery/jQueryMobile to develop the app. If anyone thinks that these are not appropriate reasons to be using PhoneGap and that I should be using something else, please let me know.
I seem to be misunderstanding some things that are apparently self-explanatory about PhoneGap, and after hours of scouring the internet looking for answers, I can't seem to find anyone else who has had the same problems as me. To clarify, I am quite comfortable with my HTML/CSS/JavaScript skills. I literally just need to GET STARTED.
I see the terms PhoneGap and Cordova used interchangeably. From the sources I've seen they are pretty much synonymous, but I'd like to know what the ACTUAL difference is.
I'm fairly certain I have PhoneGap installed. I can run PhoneGap commands and I was able to get the basic Hello World application and run it on an iPhone emulator. I then began to make changes to the files and rebuilt and reinstalled to test it and it replaced all my changes with the original application. I'm not sure what I did wrong, but I feel like I'm missing something.
Can I use other JavaScript libraries like jQuery or jQuery Mobile with PhoneGap? I'm not sure what I'm limited to, or if I can use them, what the best way is to do that.
I've seen example applications that were able to use PHP even though many sources say that you can't. How is this done?
Can multiple pages be used or is it better to modify one to make it seem like there are multiple pages?
Any other suggestions on exactly how to get started will help. Thanks!
Only edit the files in your www folder, because when you run
phonegap build ios
it copies files from the www folder into the various different platform folders (depending on which platforms you've added) and compiles an application out of them.
http://www.tricedesigns.com/ - lots of sample apps and tutorials
http://www.raymondcamden.com/ - ditto
http://coenraets.org/blog/ - ditto
http://devgirl.org/ - tutorials
https://groups.google.com/forum/#!forum/phonegap - official group
Cordova is the open source community driven version of the framework, Phonegap is a "snapshot" of cordova at a given point that Adobe specifically supports through it's build service, there are small differences but on the whole they're more or less identical in feature set and use.
You can use any JS libraries you want, and you'd use them exactly as you would normally on the web.
PHP code cannot be used inside a phonegap/cordova app but there's nothing to stop you loading data from external sources.
Regarding multiple pages, I'd generally stick with a single page and just show/hide parts of it as needed, just so you're not having to deal with re-loading libraries on each page load and adding overhead to the app itself.
As for where to start - there's a few good books out there but you could do worse than to give this tutorial a go..
http://coenraets.org/blog/phonegap-tutorial/

Dojo Application - How to

Do any of you know any reasonably good resources containing methods and tutorials to help build a Dojo driven entirely AJAX application. I have been searching Google and the Dojo Toolkit web page however not many resources seem to tie everything together..
Thanks in advance,
If you are familiar with Dojo principles the best way would be studying working source code. There is nicely commented github project dojo-boilerplate to start with. It provides, well, boilerplate code to start building a single page javascript application including preconfigured build system. Unfortunately - afaik - build scripts based on Java neither node.js does not work under Windows as of now (not even under MinGW or Cygwin due path resolving issues).
Aforementioned branch uses AMD modules new to Dojo 1.7+, for previous Dojo version employing synchronous loader use this branch.
Also have a look at build.dojotoolkit.org and check out its source code.
Last but not least, don't forget books. You can find those I prefer in my Career 2.0 Profile.

ExtJs Vs Ext GWT Vs SmartGWT

I am going to start a new application which mainly consist NavigationPane, Grid, Toolbar. Layout should look like this demo page http://www.gwt-ext.com/demo/
I am quite confused which one to use in terms of writing less code, more performant, etc..
Could someone tell the pros and cons of all these technologies.
All the while I coded in javascript, so that way ExtJs seems to be the easy one for me to code. But I am curios to try GWT Ext, Is it true that it could do a lot just by writing few lines of java code.
For eg: To achieve the layout ( given in above gwt ext demo url), which one should I opt ExtJs or GWT Ext.
I read SmartGWT is relatively slower than GwtEXT. Does it have any advantage over GWT EXT. I am also looking for hibernate based data modules ( as my application is going to have many database calls). Anyone of SmartGWT or GWTExt has support for such modules. I came to know that smartgwt doesn't offer all of smartclient enterprise version functionalities, that we are allowed only a few of smartclient features. Will it be an issue?
Your response is highly appreciated.
The GWT-Ext main page now says
"GWT-Ext is no longer under active development and has been superseded by Smart GWT. Assistance will be provided to existing users of GWT-Ext looking to migrate to Smart GWT."
so why would anyone use it?
To write the least code, use SmartGWT Pro. It provides a wizard that allows you to just pick from a list of Hibernate entities you've created, and instantly you have the ability to perform all CRUD operations on that entity, no code required. Then you can add business logic.
The wizard:
http://www.smartclient.com/smartgwtee/showcase/#tools_hibernate_wizard
The link about is just screenshots, but there are several Hibernate samples in the showcase. See especially the Master-Detail Batch Load and Save sample.
As far as performance, real-world performance of most enterprise apps is dictated by how often the application has to contact the server. In this area SmartGWT has a large lead because of features like Adaptive Filtering (see the Featured area in the SmartGWT showcase).
Almost all reports we receive of SmartGWT being "slow" are due to having Firebug enabled. Disable Firebug and performance is fine, so normal end users will never perceive slowness.
About 6 months ago, we studied whether we would use ExtJS or GWT-Ext for an internal application. We wanted the back-end to be J2EE standard frameworks (struts, spring, hibernate for persistence, etc.). We ended up choosing ExtJS because it seemed to us that GWT was not stable enough (too many changes in the API that is still recent), and Ext-GWT was always lagging behind in development.
application which mainly consist NavigationPane, Grid, Toolbar.
Well, this tells us a lot about your app, doesn't it :)
I think it comes down to how good you are at either Java or JavaScript. They are quite a different languages you know :) But if you are well-versed at both but only used Ext JS, then picking up Ext GWT (or GWT Ext, if you meant that), shouldn't be such a great deal. And if that application you are planning is going to be as simple and small as your description of it, then it's probably a perfect opportunity to try out something new.
I use GWT-Ext and it is quite good especially if you don't mind tweaking things with JSNI to customize the already existing Ext widgets it is incredibly powerful. Unfortunately development is stagnant, so my future projects will probably be either in SmartGWT or Ext-GWT. SmartGWT is written by Sanjiv Jivan (same guy who wrote GWT-Ext) and it has most of the widgets we need. I must say most of the skins are quite dated except the Enterprise skin which looks good, but you can always roll your own skin.

Categories

Resources