JavaScript for Line of Business Applications
606.5K views | +12 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!

Ember.js cheatsheet and development companion

Ember.js cheatsheet and development companion | JavaScript for Line of Business Applications | Scoop.it

Additional documentation for often needed EmberJS funtions. Provides code examples to typical use cases as well.

No comment yet.
Scoop.it!

Simplifying Grunt Jasmine tests for Ext.js

Simplifying Grunt Jasmine tests for Ext.js | JavaScript for Line of Business Applications | Scoop.it

Are you wanting to unit test you Ext.js code but not sure where to start? Do you feel frustrated that everytime you get a bug raised you don’t know how to apply TDD techniques to your JavaScript because it’s just “not the same kind of code” as your Java, Ruby, .Net?

Since I’ve worked with Ext.js and Sencha Touch, testing has long been an issue that I’ve fought with. Initially I did no testing other than opening the browser hitting refresh and retracing my steps. However last year I went to Full Frontal and attended Rebecca Murphy’s talk (video & slides) and workshop on how to write testable JavaScript. Since then I’ve been cranking out test, after test, after test, and it’s improved the quality of code and it’s stability drastically.

However it did take me a while to understand how to setup Jasmine for an Ext.js project, so I thought something could be done about this to make life simpler. So I created a new Grunt plugin...

No comment yet.
Scoop.it!

Handling concurrency and asynchronous JavaScript

If you’ve worked with JavaScript in a browser, or indeed on the server, for any length of time you’ve probably had to deal with asynchronous spaghetti. This kind of spaghetti is not delicious in any way, shape or form.

You end up with multiple boolean variables and function calls constantly checking if all of those AJAX requests have finished; it is far from ideal. I’m going to show you how to break the problem down and come out of the other side with your sanity still intact.

The first step in explaining this involves creating a problem, here’s the scenario: You’re running a site like gist.github.com and you need to fetch some meta data for a list of gists from the server. This is going to involve you making multiple requests and then doing something when they’re all finished, you’ll probably want a loading spinner overlay or something while it fetches them as well.

No comment yet.
Scoop.it!

AngularJS Do’s and Dont’s

Since the past year, I have been observing the market and adoption of AngularJS in the wild. I really like what I am seeing. It surely has come a long way from being called a toy framework, esoteric research framework to where it is today.

Having worked with this framework from the start and having answered quite a few questions about it on Stack Overflow I have noticed a few common mistakes that people do when working with AngularJS. I will in this post attempt to address a few of these problems and what would be the right way to do the same.

* DONT : Access DOM in the Controller
* DONT: Use Selectors in Directives
* DONT: Use Scope elsewhere ( other than controller )
* DONT: Write business logic in controllers
* DO: data in Services

No comment yet.
Scoop.it!

Put on Your Asynchronous Hat and Node

Put on Your Asynchronous Hat and Node | JavaScript for Line of Business Applications | Scoop.it

Doing a little bit of asynchronous programming in the browser isn't all that difficult, but tackling it with Node.js on the server may be a very steep learning curve. This presentation at Web Directions 2013 by Marc Fasel will explore the asynchronous features of Node.js, describes code patterns for asynchronous applications, and shows how asynchronous libraries can be leveraged to build maintainable and scalable Node.js applications. 

No comment yet.
Scoop.it!

Modern JavaScript: Promise patterns

Modern JavaScript: Promise patterns | JavaScript for Line of Business Applications | Scoop.it

Promises are great for giving us a way of writing asynchronous code without having to indent our code but if that's the only thing you're using them for then you're missing the point of promises. Promises are an abstraction that make doing several things easier. They have two properties that make them easier to work with:

* You can attach more than one callback to a single promise

* values and states (errors) get passed along

Because of these properties it makes common asynchronous patterns using callbacks easy. Here are some cases which may pop up from time to time: 

* Converting callback functions to return promises

* Sequential Calls

* Error Handling

* Pool

* Some fun

No comment yet.
Scoop.it!

Reactive table

Reactive table | JavaScript for Line of Business Applications | Scoop.it

React is all about components. So let's build one.

You see that React components are defined using a regular JS object. Some properties and methods of the object such as render() have special meanings, the rest is upforgrabs.

A table is a way to neatly and orderly present some data. The data is front and center, the most important thing. And data is what you should focus on - retrieving, updating, saving, etc.

Once you have the data, you let React take care of the presentation part.

You want the UI to react to changes in the data. So you need a stateful component. Meaning one that has state. This is easier than it sounds.

As you can see the state is an object. Simple as that, the old familiar {key: value}situation. In this case the state is just one property of the state object, appropriately named data. ...


No comment yet.
Scoop.it!

4 Lessons Learned Doing Angular on Rails

4 Lessons Learned Doing Angular on Rails | JavaScript for Line of Business Applications | Scoop.it

We’ve been working on one of our first Angular projects with a Rails backend. It’s been a great experience. I wanted to share a few things we learned that we hope are helpful to others building Angular on Rails apps.

In the Rails world, “Fat models, skinny controllers” has been some of the most oft-quoted design advice for many years. In angular.js, this also turns out to be solid advice. Getting logic out of your controllers makes it easier to reuse and also helps improve the design of your codebase (e.g. Single Responsibility Principle). I’d like to share a couple of the ways to put your angular.js controllers on a diet.

The most common way you’ll run across to move code out of your controller is to move into a service created by a factory and then inject it where you need it. To illustrate, here’s a controller with a method that generates a random number.

No comment yet.
Scoop.it!

Differences Between Providers in AngularJS

Differences Between Providers in AngularJS | JavaScript for Line of Business Applications | Scoop.it

After reading a lot of articles and sample code it wasn’t clear to me what the difference was between the several providers like provider, factory and service. Without this knowledge you could not select the proper provider. I will explain the differences between the providers with examples.

AngularJS uses $provide to register new providers. The providers basically create new instances, but only once for each provider. The $provide has six methods to create custom providers and I will explain each one of them with the help of sample code. These providers are available on $provide:
* constant
* value
* service
* factory
* decorator
* provider

No comment yet.
Scoop.it!

Building Out a Clean, REST-ful Web Api Service with a Minimal Web Api Project

Building Out a Clean, REST-ful Web Api Service with a Minimal Web Api Project | JavaScript for Line of Business Applications | Scoop.it

n a previous post, we saw how to create a minimal ASP.NET WebApi project template, so that we can avoid some of the bloat and complexity inherent in the standard VS WebApi project. Getting started building out an API project using the minimal project template is much easier, and we can always add back stuff as our project grows.

For starters, though, the minimal project makes it much easier to focus on our principle task – creating a simple, clean API. This minimal project is especially useful if, like myself, you are less-than-experienced, and learning your way through Web API development. Or, if you just want a simple project.

In building our example, we will adhere to what are recommended conventions for an MVC project. While we are not creating a website proper, it will serve us well to follow the conventions designed into the MVC framework (of which WebApi is a part). Note how I have set up the basic project, with a Models folder and a Controllers folder (at this point, we don't need Views). If you have worked with a standard ASP.NET MVC project before, this part should look pretty familiar.

No comment yet.
Scoop.it!

Request-Response oriented Websockets

Request-Response oriented Websockets | JavaScript for Line of Business Applications | Scoop.it

The nature of websockets allow realtime data transfer between two peers in “realtime”. This mechanism is perfect for exchanging events without relation to each other. But what if you want to ask your peer for some specific response and wait until this particular response arrives?

This pattern is well-known under the name Request-Reply or Request-Response and builds the basis for todays HTTP communication on the web. Following JavaScript code shows how the Node.JS API implements this pattern to request some HTTP response from a webserver:

As soon as a response is available, the callback function armed with the response object gets executed and the awaited data is processed.

Using websockets, you do not have this mechanism built-in since there is not really a response which has to follow on a request. More precisely, there is not even a thing called request: You exchange data with no relation to each other.

Primus Responder resolves this situation while being a plugin for the realtime communication wrapper Primus. It allows to request the opposite peer for a response using a simple API known from other libraries.


No comment yet.
Scoop.it!

How to Build an AngularJS Filter

How to Build an AngularJS Filter | JavaScript for Line of Business Applications | Scoop.it

I have recently been working with AngularJS and I have to say, I haven't felt this productive since Rails. I'm a bit of an architecture nut and AngularJS gives me all the building blocks to build a well structured application.

The first building blocks that everyone learns are filters. They are one of a few ways to get presentation logic out of your business logic. Filters format data to be displayed to the user. In this post, I will show you how to build a simple phone number filter. First, lets see how filters would work.

Filters are functions that are passed an expression.

n AngularJS, it is best to build a bunch of smaller modules and then craft them together to build a larger application. Not only does this make it easier to test, but it becomes very easy to reuse components. Following that mantra, we will build a filter as a standalone module.

A filter is just a function that is executed on some input.


No comment yet.
Scoop.it!

Writing AngularJS controllers with CoffeeScript classes

When I started using AngularJS one of the obstacles I ran into was using CoffeeScript classes to develop the controllers. Most examples show an inline JavaScript function, which I can easily duplicate with CoffeeScript. However, to make use of a CoffeeScript class, I had to play around with it till I figured it out.

In this post I’ll provide a look at converting the simple Todo app on the Angular page to CoffeeScript. I’ll cover the process I went through while figuring this out, which includes:

* A 1:1 JavaScript to CoffeeScript conversion using functions
* Using a CoffeeScript class with all functions defined in the constructor, off of $scope (don’t do this)
* Defining methods on the class instead of on $scope and assigning the class to the $scope (good)
* Using the new Angular 1.1.5+ controller as syntax and an example of CoffeeScript using a class and base class (good)

No comment yet.
Scoop.it!

Creating modern web applications with Django and ember.js JavaScript framework

Creating modern web applications with Django and ember.js JavaScript framework | JavaScript for Line of Business Applications | Scoop.it

In this article I'll showcase basic ember features and ember application development process for a Django-Tastypie-Ember application.

As you can read on ember website the framework has few layers, similar to Django or other frameworks. I won't repeat what's written there. I'll just give a quick overview from a Django developer point of view.

tastypie is a handy app that will make an REST API for use to use in ember application. To make a Tastypie resource we first need to have a Django model. When we have working Tastypie resources we can start creating models in ember application. Data aspects in ember are handled by ember-data.

At first many things in ember may look like magic (events and asynchronous actions), but when you look how this basic app is being made and how it works - the magic will become clear (or you will become a sorcerer which is cool anyway :)).

No comment yet.
Scoop.it!

Exploring JavaScript prototypes via TypeScript’s class pattern

Exploring JavaScript prototypes via TypeScript’s class pattern | JavaScript for Line of Business Applications | Scoop.it

In this post, I’m going to take a close look at how JavaScript’s prototypal inheritance works by analysing how Microsoft’s TypeScript language uses it to provide a simple implementation of classes. Don’t worry if you’ve never used TypeScript, we’re not really concerned with the language itself here, just the JavaScript that is produced by its compiler, and how it achieves class-based inheritance in a language that doesn’t natively support it.

This is of particular importance because EcmaScript 6 will include classes that work a lot like TypeScript’s. The idea of adding classes to JavaScript is controversial, but I think some of the hostility stems from a mistaken belief that classes are some kind of competing inheritance mechanism to prototyping, or are an attempt to turn JavaScript into Java. In fact, modern proposals for classes in JavaScript are just a syntactic codification of prototypal inheritance patterns that are already in use.

No comment yet.
Scoop.it!

Angular JS – Making Directives self-contained in our ASP.NET MVC Twitter App

Angular JS – Making Directives self-contained in our ASP.NET MVC Twitter App | JavaScript for Line of Business Applications | Scoop.it

Today we will revisit Directives in an attempt to make them more self-contained and re-usable.

In our previous Routing article, we had created a new separate Controller for our Status page called the StatusController. But unfortunately we found out that our Retweet Directive was broken in the Details page because the button click handler that was doing the actual Retweet action was in the TimelineController. This led us to abandon the StatusController and stuff everything back into TimelineController. That was an ugly hack. After all we want the Retweet functionality to be self-contained and reusable. Let’s see how we can do this.

Fortunately there is one concept about Directives that we haven’t visited yet and that is Directive specific controllers. Yup, directives can have their own controllers as well. Today we’ll see how to use this concept of modularize our Retweet button Directive.

No comment yet.
Scoop.it!

Falcon.js | Structure for Knockout

Falcon.js | Structure for Knockout | JavaScript for Line of Business Applications | Scoop.it
Falcon.js is an MV* framework that helps organize small and large single-page applications that wish to utilize Knockout.js for templating and data binding. Models represent individual data objects that need to sync with server data.

Falcon.js is an MV* framework that helps organize small and large single-page applications that wish to utilize Knockout.js for templating and data binding. Falcon provides:

* Models represent individual data objects that need to sync with server data
* Collections represent a list of models and provide numerous list filtering methods
* Views relate functionality between data objects and Knockout templates

Jan Hesse's insight:

https://github.com/stoodder/falconjs

No comment yet.
Scoop.it!

Eight Cool Features Coming in ES6

Eight Cool Features Coming in ES6 | JavaScript for Line of Business Applications | Scoop.it

ES6 is coming and with it brings many great things that will help us develop better and faster web applications. Let’s have a look at the most significant ones.

In ES6 there is a lot of syntax sugar that will shorten development time and speed up our applications. Let’s have a taste, shall we?

Finally, ES is turning into a true object-oriented language. With the introduction of classes, we can write our code in a clean and structured way. It will remove the need for the current coded solutions present in nearly every popular library...

* Syntax Sugar
* Classes
* Modules
* Maps and Sets
* Iterators
* Weak Maps
* Proxies
* Template Strings
* Conclusion

No comment yet.
Scoop.it!

Extending Ember.js

Extending Ember.js | JavaScript for Line of Business Applications | Scoop.it

Developing a web application with with Ember.js is awesome but can sometimes be a little tricky. Every now and then you figure something out that help you every day. Here's a small extension of Ember.Object that we use as a base for practically all of our resources.

The app I'm developing consist of resources holding data that the user want's to edit, sometimes a few at a time. We need an edit mode and restore on cancel functionality. This is out starting point, so let's start extending!

No comment yet.
Scoop.it!

Keeping your sanity with Ractive.js

Keeping your sanity with Ractive.js | JavaScript for Line of Business Applications | Scoop.it

One of the most frustrating parts of writing web apps is DOM manipulation and event handling. To demonstrate this, let's use this common scenario - we want to hide an element and show another one when a user click on the 'add-note' textbox.

We will look at two way of doing it - one with jQuery and the other with Ractive.js. At the end we'll talk a bit about Ractive.js and how it compares to AngularJS and Ember.js.

No comment yet.
Scoop.it!

Moving Data In An AngularJS Directive

Moving Data In An AngularJS Directive | JavaScript for Line of Business Applications | Scoop.it

This plunkr demonstrates a few different scenarios and capabilities when moving data between a model and a directive. Like other places in Angular JS there are quite a number of different approaches that work, which grants a lot of flexibility but also leads to some confusion.

The example uses a simple controller.

he first version of valueDisplay will put the value on the screen, but will never update the screen if the magic value changes. This approach is only reasonable for static data since the directive reads the value directly from the controller’s scope (using the name specified in the attribute), places the value in the element, then never looks back.

The second version of valueDisplay uses a $watch to update the screen as the model value changes. Notice the attribute value (value="magicString")  is still working like an expression to retrieve and watch data directly from the controller’s scope.

No comment yet.
Scoop.it!

TypeScripted Knockout in ASP.NET MVC

TypeScripted Knockout in ASP.NET MVC | JavaScript for Line of Business Applications | Scoop.it

We take a look at how to use TypeScript’s definitions for KnockoutJS to build a small ASP.NET MVC application. Along the way we explore the TypeScript language and gauge how it can be potentially used for build ASP.NET MVC applications that lean on the client side JS Libraries for richness and interactivity.

* Getting Started with TypeScript in Visual Studio 2013 Preview
* TypeScript in ASP.NET MVC
* The Task Listing App in TypeScript
* Setting up our Knockout ViewModel using TypeScript
* Updating View to use client side bindings
* Summarizing our TypeScript code

No comment yet.
Scoop.it!

Upgrading your old Ember.js application.

Upgrading your old Ember.js application. | JavaScript for Line of Business Applications | Scoop.it

Hi all! I was recently working on a blogpost about developing a cutting-edge web application using Rails + Ember.js. And guess what! Suddenly, Ember.js reached its final version: 1.0.0, that's it, no more release candidates!

Along with this first final version, the Ember.js core team released Ember Data 1.0.0-beta.1, and if we compare it with the previous version 0.13, it has a lot of changes, so upgrading your old Ember.js application could be a bit messy!

Why am I saying this? Well, because your application might stop working! As you probably know, JavaScript applications have a tendency to break with the slightest change.

So, here I just want to show you the most important changes that I found while I was upgrading my Ember.js example application. It's worth mentioning that the major changes come from Ember Data.

* Models

* Adapters & Serializers

* Retrieving data from the server

* Controllers

* Upgrading Ember.js from a Rails application

* Conclusion

 

No comment yet.
Scoop.it!

Knockout.js tips and tricks

Knockout.js tips and tricks | JavaScript for Line of Business Applications | Scoop.it

Knockout.js is a very powerful 2-way binding MVVM framework for JavaScript built by Steve Sanderson. The basic idea is rather than work directly with the DOM, a ViewModel ties a JavaScript object to the DOM and any updates to the ViewModel are automatically reflected in the DOM and any DOM changes are reflected in the ViewModel. It provides very little opinion on specifics about how to structure applications which makes it flexible.

Below are some tips and tricks I've learned in using Knockout in a few large scale applications.

* Context Issues
* Better ViewModels with a BaseViewModel
* Accidental Rendering Templates
* Using Extenders
* Working with fn
* Require.js
* Custom Bindings
* Conclusion

No comment yet.
Scoop.it!

Synergy between Services and Directives in AngularJS

Synergy between Services and Directives in AngularJS | JavaScript for Line of Business Applications | Scoop.it

You’ve probably heard it a thousand times now. “AngularJS teaches HTML new tricks.” The way it does that is through directives. In my last related post I covered how to build a testable filter. Directives can be tested in a similar fashion, but what happens when they have to interact with the rest of your application? Instead of teaching your controllers how to talk to UI components, or overloading the $scope object, look to services as the mortar to hold pieces of your app together.

No comment yet.