JavaScript for Line of Business Applications
606.6K views | +10 today
JavaScript for Line of Business Applications
Keeping track of current JavaScript Frameworks that help design your clientside Business Logic Layers.
Curated by Jan Hesse
Beam to my Inbox:
Your new post is loading...
Your new post is loading...

Popular Tags - Filter using the Funnel

Scoop.it!

Using PhantomJS at scale

Using PhantomJS at scale | JavaScript for Line of Business Applications | Scoop.it

About a year ago SmugMug had a dilemma. Our upcoming site-wide redesign and refactor  (aka the new SmugMug) moved all of our rendering code into client-side JavaScript using YUI. We had a problem; SEO is critical for our customers and search engines couldn’t index the new site.

Possible solutions were thrown around: do we duplicate our code in PHP? Use an artificial DOM? What about PhantomJS? Duplicating code would be a monumental effort and a continued burden when writing new features. Initial tests of fake/artificial DOMs proved unreliable. A small prototype Node.js web server that hooked into PhantomJS proved promising. Node.js’ async model would be perfect for handling things that wait for I/O like rendering webpages. We came up with the project name ‘The Phantom Renderer’ soon after.

No comment yet.
Scoop.it!

Writing a 70 line JS Router

Lately I’ve been working pretty closely on some MVVM frameworks. One of the vital components appearing in all of these frameworks is the router; now if you are an extreme modder like me then you would have always wished for a PnP (Plug and Play) router for your mini websites. Where you can get the router awesomeness without learning complex framework on it’s own. Now if you Google there are already options likeRoutie, Davis.js etc. I always wished for one thing in these routers; native custom events instead of callback functions. 

No comment yet.
Scoop.it!

Staggering Animations in AngularJS

Staggering Animations in AngularJS | JavaScript for Line of Business Applications | Scoop.it
ngAnimate now supports staggering animations natively

With the release of AngularJS 1.2, a crazy, but hidden, feature was introduced which provides native staggering support to CSS3 transitions and keyframe animations with just a little extra CSS code. The $animate service, found within ngAnimate, will do the grunt work to render animations in a staggering fashion.

Still curious as to what a stagger is? Does Greensock ring a bell? Well if not then a stagger is an animation that occurs that contains a delay between each successive animation which causes a "curtain-like" effect to occur. Click here to see how GreenSock performs a stagger animation.

No comment yet.
Scoop.it!

Unit Testing in JavaScript

Unit Testing in JavaScript | JavaScript for Line of Business Applications | Scoop.it

JavaScript has come a long way. There was a time it was easily dismissed – maybe suitable for noncritical validations, but not much else.

Over the years, the worst of the obstacles to writing large-scale JavaScript programs have fallen away, or at least been mitigated. JavaScript dialects are more consistent among browsers than they once were, and tools like jQuery can help smooth over the differences that still exist. Debuggers are at least not as terrible as they once were (though a lot still depends on what browser you can use to debug).

And in any case, with the advent of HTML5 and mobile platforms, JavaScript is becoming much harder to ignore. Whole application front-ends are being written in JavaScript, and while the tool support lags well behind what we expect in Java or C#, it’s evolving.

One area that remains particularly challenging, and that will become incredibly important as JavaScript projects grow in scope, is unit testing.

No comment yet.
Scoop.it!

JavaScript Getters and Setters

JavaScript Getters and Setters | JavaScript for Line of Business Applications | Scoop.it

For the most part, in JavaScript, what you see is what you get. A value’s a value; there are no tricks. Sometimes however, you want a value that’s based on some other values: someone’s full name, for example, is a concatenation of their first and last names. If you have a person object, and you want the users of that object to be able to set the full, first or last name, and see that change immediately reflected in the other values, you’d conventionally build it with functions:...

But this is ugly, and requires the users of your object to care that the properties are related; in a more complex example, that might not be as obvious as with names. Luckily, there’s a better way, added in ECMAScript 5.

Meet getters and setters.


No comment yet.
Scoop.it!

Knockoutjs : To observable or not for complex type

KnockoutJs provides one of the easiest way to bind your data to HTML elements, well all you have to do is add a data-bind attribute to the element, and you can do almost anything and everything well ... almost. To make things more interesting let , it will also update your HTML if the data is changed somewhere else .. easy... well not quite as long as your data is an observable

Jim Hunter's curator insight, December 24, 2013 11:44 PM

This is quickly becoming one of my favorite JavaScript libraries. I gives you an MVVM framework that simply works. No long learning curves, it just makes sense. Highly recommended!

Scoop.it!

Knockoutjs – Filtering a Table Using Selects

Knockoutjs – Filtering a Table Using Selects | JavaScript for Line of Business Applications | Scoop.it

However, the further in to the redevelopment I got, and the more I converted the existing site to rely more on ajax/json, the more complex my requirejs modules were becoming.  Not least because of the sheer amount of jquery event handlers I had to write to update tables etc..  Manipulating the DOM was becoming increasingly difficult.

Short story, long, I decided to try and implement an MVVM framework.  I needed something that could handle 2-way data-binding, but without a steep learning curve.  I decided to try Knockoutjs.

I was working to implement a guestlist feature that displays a table of guests and the number of free and concession guests they were bringing to an event.  Once this was put together, I needed to be able to filter the list to display all guests, those with only free guests, and those with only concession guests.  I came across a very handy tutorial byRyan Rahlf.  It describes exactly what I was trying to accomplish.  I created three buttons (blue buttons in image) that, when clicked, applied the appropriate filter to the table data.

I did have to make an adjustment to the code as described by Ryan due to the fact that I’m using a newer version of Knockoutjs.  The method that returns the filtered array of guests in Ryan’s example uses ko.arrayUtils.filter() to filter the array of people:

No comment yet.
Scoop.it!

Proposing a native Event Emitter in JavaScript

Proposing a native Event Emitter in JavaScript | JavaScript for Line of Business Applications | Scoop.it

JavaScript events are very powerful, they give you the power to capture real world events in real time. For example, when a user moves their mouse in the browser or when they click.

Using JavaScript events to interact with DOM objects defined Web 2.0 and is still widely used (thanks to jQuery and similar libraries) but it has its limitations, the events are predefined and tied to the browser BOM and DOM.

A more powerful implementation of JavaScript Events is in Event Emitters. Most of the popular JavaScript libraries/frameworks have their own implementation of Event Emitters.

My framework of choice is backbone.js and it uses Backbone.Events to implement Event Emitters.

No comment yet.
Scoop.it!

JavaScript MV* Shootout!

JavaScript MV* Shootout! | JavaScript for Line of Business Applications | Scoop.it
Backbone vs. EmberJS vs. AngularJS.

* "C” in MVC doesn’t exist in many of the new frameworks

Backbone has no Controller object to extend; it’s more like an MVP framework where the view does more than displaying data

* Angular has controllers and services … MVCS?

* Ember has controllers in a more um … classical(?) sense

* Backbone as sort of a “control”

* Oldest of the three, wildly successful and well-understood

* Angular and Ember because they seemed to have the most steam

No comment yet.
Scoop.it!

Understanding the Node.js Event Loop

Understanding the Node.js Event Loop | JavaScript for Line of Business Applications | Scoop.it

Ah, the great and crazy Node.js Event Loop. Often talked about, rarely intimately known. What does the Node.js Event Loop do? What does it provide the programmer? Let’s dive in and talk about what the event loop is and does and how it can help you in your day to day development.

In the case of most pre-node.js Javascript, it existed in the browser and took user events manipulate the content of the rendered page in the browser. Manipulating these events were the only real interaction the code had. It was a single route of actions that the programmer had to deal with. Besides the DOM (that’s another whole discussion) the Javascript world on the browser side was relatively simple.

Enter server side JavaScript via Node.js. All of a sudden JavaScript now can deal with all of the interactions on a server. This changes the paradigm of JavaScript development dramatically, from a single event happening at a time to the need for many things to start, stop and evolve over time. So how does JavaScript, and Node.js, deal with this new complexity on the server side?

No comment yet.
Scoop.it!

Using Passport.JS with Sails.JS

This is the tutorial I wish I had for integrating Passport.js with Sails.js. When creating web applications, you'd love to have a user sign-in and sign-out function, while limiting access to certain functions if the visitor is merely a guest.

Enter Passport.js. This fantastic piece of unobtrusive Express middleware provides many mechanisms of authorization, including the usual username/password, or even social media such as Twitter and Facebook.

Sails.js is based off Express, so we'd expect Passport.js to slide in nicely, and it certainly does. Without further ado, let's get to making an application!

No comment yet.
Scoop.it!

D3.js: How to handle dynamic JSON Data

D3.js: How to handle dynamic JSON Data | JavaScript for Line of Business Applications | Scoop.it

When I started with d3.js, I really struggled understanding how I could link data from a JSON feed to a SVG graph. I read a lot of tutorials but still, I couldn't find what I was looking for. Now that I know how d3.js behaves, I thought it would a good idea to share the things that I learned.

When you start using the library, there's stuff that might be foreign to you:

* It uses SVG which many of us have no experience with.

* SVG has an opposite y-coordinate system (0 is on top, height() is at the bottom).

* stroke, fill, clipping, etc.

My goal was to create a dynamic graph that I could add, edit and remove data and have d3 update the graph in real time but I couldn't understand how to handle enter() and exit() with JSON. Many examples out there were done using static data so it wasn't covering my issues with JSON.

Throughout this post, I will be using this response as an example of a JSON response to show you how to represent your JSON into a graph.

No comment yet.
Scoop.it!

Learn JavaScript Part 2 - Space Invaders

Learn JavaScript Part 2 - Space Invaders | JavaScript for Line of Business Applications | Scoop.it

Welcome to part two of my series on learning Javascript. In this article, we'll create the classic Space Invaders game, step-by-step. For now we're keeping it really simple - no frameworks, just raw JavaScript and HTML. Here's a screenshot of what we're going to make. 

In part two of the learn JavaScript series we'll create the classic space invaders game.

Jan Hesse's insight:

http://www.codeproject.com/Articles/642499/Learn-JavaScript-Part-1-Create-a-Starfield

http://www.codeproject.com/Articles/681130/Learn-JavaScript-Part-2-Space-Invaders

http://www.codeproject.com/Articles/696943/Learn-JavaScript-Part-3-AngularJS-and-Langtons-Ant

Tyler Richendollar's curator insight, December 20, 2013 12:05 PM

For practice.

Scoop.it!

Iterating over JavaScript objects

Iterating over JavaScript objects | JavaScript for Line of Business Applications | Scoop.it

One of the things I love about JavaScript is the fact that objects in JS are really just simple hashes of key/value pairs. What's nice about that is that the keys (properties, members, whatever you want to call them) are enumerable. So of course, we all know what that means, right? Right...you caniterate over JS objects. I mean, we all knew we could iterate over collections of objects, but the object itself? Yeah...its OK...I didn't realize it at first either, but its really nice to be able to do that. Knowing this opens up some nice possibilities, doesn't it?

Lets say, as an example, that you wanted or needed to write your own object extension/mixin functionality. Such a function would need to iterate over a source object in order to copy its members onto the target object, right? Lets take a look at how we might do something like that:...

No comment yet.
Scoop.it!

Introduction to SailsJS

Introduction to SailsJS | JavaScript for Line of Business Applications | Scoop.it

Over the past few days, I've started working on rewriting one of the web applications I manage using SailsJS, a NodeJS MVC framework that's built on top of Express and is intended to mimic Rails MVC patterning and functionality. Part of Sails' unique appeal is that it provides fantastic out-of-the-box support for data-driven applications: a RESTful JSON API is automatically generated for each model, saving time writing backend code for single-page apps in Backbone, Angular, and the like. Sails also provides automatic Socket.io support for realtime apps, making it a good choice for chatrooms, multiplayer games, and the like.

Sails is a fairly new framework (as with everything on Node); tutorials exist but are fairly few and far between. The documentation is actually pretty fantastic; it's probably my favorite documentation of any framework I've encountered, including Rails.

No comment yet.
Scoop.it!

JavaScript Unit Testing with Visual Studio

JavaScript Unit Testing with Visual Studio | JavaScript for Line of Business Applications | Scoop.it
Mark Michaelis walks you through the Visual Studio tooling and project setup you'll need to get the most out of your JavaScript unit testing.

Of all these characteristics, it's JavaScript's lack of type safety coupled with not having a compiler fail in the capacity to verify intent. That is, of course, if you don't have unit tests. Unit tests can compensate for the lack of type safety. And unlike with .NET, where unit tests focus mainly on functional verification (since the compiler eliminated the majority of typos), unit tests in JavaScript do both. In summary, JavaScript unit testing is all the more critical because it's responsible to not only verify functionality, but also to verify syntax and language semantics.

In this article, I'm going to focus on the Visual Studio tooling and project setup requirements needed to get the most out of your JavaScript unit testing.

No comment yet.
Scoop.it!

Function = Var + Return: A Functional Style of JavaScript Programming

Function = Var + Return: A Functional Style of JavaScript Programming | JavaScript for Line of Business Applications | Scoop.it

JavaScript is a flexible language with first-class functions, so it supports a functional programming style. Usually people do this with a library such as Underscore.js, which provides array operations like “map” and “reduce” and function operations like “bind” and “compose”. This is very cool. For example, when you use “map”, you work at a higher level of abstraction. You don’t have to worry about a temporary index variable for iterating over the array, so the code becomes shorter and clearer.

 

However, this approach is not as functional as it could be. If you’re freely assigning values to variables, then you’re still relying on changing state. If your code is primarily a sequence of statements, it’s imperative or procedural, and you’re missing the peculiar beauty of functional code.

No comment yet.
Scoop.it!

Experiments with Koa and JavaScript Generators

Koa is a new application framework for Node.js. Its whole point is to eliminate the callback madness that plagues many Node.js apps. It achieves this previously-impossible feat by using the powerful generators feature which is new in JavaScript ES6. Koa is built by the same people who created Express, the best-known Node.js application framework, so it’s at least worth a look.

Having written plenty of callback-heavy JavaScript, I was excited to give this thing a go and see how much simpler it could make my code.

This blog post is purely about generators and async in Koa. If you want to actually build an app with Koa, go and read the framework’s website. If you’ve never used Express (the earlier incarnation of Koa’s ideas) then be sure to learn aboutmiddleware, the central architectural pattern in Koa, so you will see how the framework intends your application to be organised.

No comment yet.
Scoop.it!

Rendering on the Server and Client in Node.js

Rendering on the Server and Client in Node.js | JavaScript for Line of Business Applications | Scoop.it

At Artsy we’ve been building Node.js applications that share code and rendering between the server and browser. We’ve seen many benefits from this – pages load faster, we can optimize SEO, developers are more productive, and JavaScript coding is just an overall better experience.

Today we’re happy to announce Ezel, our open source boilerplate we use to bootstrap our Node projects and the various node modules that built up to it.

 In this article I’ll tell Artsy’s story of moving from a single monolithic application to modular Backbone apps that run in Node and the browser and consume our external API.

A monolithic app that treats it’s client-side code as a second class citizen was clearly not going to scale. Our poor mobile web experience was a good candidate to try something new. So we started building a separate mobile optimized website (m.artsy.net).

Some goals became clear:

* Better client-side tools from JavaScript testing to package mangers.

* Share rendering code server/client to reduce duplication and optimize initial page load.

* Flexibility. We needed a way to divide our app into smaller chunks with smaller asset packages.

 

Jan Hesse's insight:

http://ezeljs.com

No comment yet.
Scoop.it!

Quick and Easy Sencha ExtJS and Touch Model Javascript creation

Quick and Easy Sencha ExtJS and Touch Model Javascript creation | JavaScript for Line of Business Applications | Scoop.it

Most of my projects revolve around real-world applications which utilize complex data architecture in SQL databases.  Exposing this data using RESTful approaches (more on that in a later blog post) and JSON consumed by the Sencha Model and Store objects is a godsend in developing robust, responsive web/mobile applications.

The process of taking SQL table and view definitions and converting them by hand to appropriate, well formed Model definitions was, to my lazy programmer side, a royal pain.Especially in an iterative, agile development environment where the under-lying SQL schema was going through as many changes as the front end code.

After finding myself, may times, chasing a bug or behavior that turned out to simply be the lack of synching the SQL data model to the Javascript model, I decided to work up a small time saver: A SQL function to generate the ExtJS/Touch model definition Javascript directly from the table/view definition - ExtjsModelGeneration.

No comment yet.
Scoop.it!

Real-Time AngularJS SDK with Live Chat Example

Real-Time AngularJS SDK with Live Chat Example | JavaScript for Line of Business Applications | Scoop.it

Over the past few months, it has been really exciting to follow the phenomenal traction and explosive adoption of AngularJS, an Open Source framework for Web Application development, originally started by developers at Google and now receiving global attention.

Over the course of building a few PubNub-enabled AngularJS applications, we came across a bunch of patterns and features that we thought would be useful for AngularJS developers, for example:

* an Angular service to inject the PubNub object into controllers.

* an Angular-friendly mechanism for binding events to the root scope.

* additional bookkeeping functions for providing easy access to collections (such as the presence and channels lists).

No comment yet.
Scoop.it!

Functional JavaScript for crawling the Web

I've been giving JavaScript & CasperJS training sessions lately, and was amazed how few people are aware of the Functional Programming capabilities of JavaScript. Many couldn't see obvious usage of these in Web development, which is a bit of a shame if you ask me.

Let's take things like map and reduce from the Array prototype.

I've been hearing a few times things like: Well yeah that's cool, but I don't do maths, I'm a Web developer.

And each time it turns me a little sad.

 

As we're programming language hipsters, in this article we'll use ES6 short function syntax which has landed a few weeks ago in Firefox Nightlies and eases a lot writing code in the functional style.

We'll also use other ES6 features as well because, you know, today is our future already.

This article contents will also probably hurt some people feelings, probably because there's a lot to hate in there when you come from a pure OOP landscape. Please think of this article as an exercise of thought instead of yet another new JavaScript tutorial™.


No comment yet.
Scoop.it!

Testing AngularJS directive templates with Jasmine and Karma

Testing AngularJS directive templates with Jasmine and Karma | JavaScript for Line of Business Applications | Scoop.it

In my day job, I work on appear.in, a video chat service built with AngularJS and WebRTC. Recently, our application has become more complex, and our HTML templates ended up having a lot of state in them. We could no longer just use unit testing to verify our application logic, we also needed to test the state in our templates.

For our unit testing, we landed on using Jasmine and Karma, and this has worked fairly well for us. So when we wanted to test our templates, we wanted to use the same tools.

No comment yet.
Scoop.it!

The Future of JavaScript MVC Frameworks

The Future of JavaScript MVC Frameworks | JavaScript for Line of Business Applications | Scoop.it

We've known this for some time over here in the ClojureScript corner of the world - all of our collections are immutable and modeled directly on the original Clojure versions written in Java. Modern JavaScript engines have now been tuned to the point that it's no longer uncommon to see collection performance within 2.5X of the Java Virtual Machine.

Wait, wait, wait. What does the performance of persistent data structures have to do with the future of JavaScript MVCs?

A whole lot.

No comment yet.
Scoop.it!

My path to the real-time Web

My path to the real-time Web | JavaScript for Line of Business Applications | Scoop.it

Among other things in this blog post I’ll describe an example of how the usage of real-time can save you 99% of backend requests, while making your code simpler and your user interface snappier along the way.

Then, about a year ago, I stumbled across an old friend of mine who happens to be the author ofAutobahn, an open-source real-time framework for Web, Mobile & Internet of Things.

It took some time until I was convinced of the simplicity of his technology, but eventually I found that I did not need to understand the inner complications of sending messages over WebSocket from A to B in order to use Autobahn.

Once I had WebSocket working in my app, I was just a tiny step away from getting server pushed messages into the client browser. I very much liked this idea to get rid of those refresh buttons everywhere in the frontend. That was a low hanging fruit then and I quickly got some really nice changes in interface design (like live chat, object locking in the frontend and real-time refresh).


No comment yet.