JavaScript is the original and common name applied towards most flavors of a scripting language that originated on NetScape Navigator. Use this tag for questions regarding common implementations of ECMAScript, JavaScript, JScript, etc. JS does not typically refer to its ECMA-cousin, ActionScript.

learn more… | top users | synonyms (1)

5
votes
0answers
324 views

JavaScript Combination Inheritance Pattern

In the chapter of Professional JavaScript for Web Developers on OOP, Nicholas Zachas describes a JavaScript inheritance pattern which he refers to as combination inheritance. The basic idea is that ...
4
votes
0answers
207 views

Unit Testing a stateful framework such as Phaser?

I'm currently writing a game in TypeScript and the Phaser framework. Phaser describes itself as an HTML5 game framework that tries as little as possible to restrict the structure of your code. This ...
3
votes
0answers
107 views

Set of specific values implementation vs. using some sort of generic set with advanced checks

I am working on a set implementation in JavaScript currently. This should kind of simulate generics as known from Java or C#. I need a mutable version of that (allows for adding/removing set values) ...
2
votes
0answers
51 views

Mapping different XML and CSV feeds

Not sure if this is the right venue to be asking this but here goes. A little background. I'm trying to build an ecommerce app that would allow sellers from other venues--like, amazon and newegg--to ...
2
votes
0answers
119 views

is this a valid javascript design pattern when many instances are required?

I have some code that I'm refactoring, right now its just a list of functions, primarily jQuery. The code is a form builder. The user adds sections, questions etc using jqueryUI drag/drop/sort. They ...
2
votes
0answers
83 views

Preserving data in js with multipage application

One benefit of single page applications like Angular.js, is that you can store data in a global variable and access in multiple routes. With multiple page applications, the data is lost during ...
2
votes
0answers
205 views

Javascript callback design: is it OK to have side effects?

Consider this javascript function: function(){ var someArr = [...]; var someObj = {...}; someArr.forEach(function(item){ if (matchItem(item)){ ...
2
votes
0answers
90 views

Can/should objects share methods in certain circumstances?

I am currently working on a web application that is supposed to resemble an operating system with GUI (it manages processes and windows). I have several constructors which deal with different aspects ...
2
votes
0answers
133 views

Distributed vs Centralised configuration

We're building an app based on Flux/React - and we're trying to establish a scalable pattern for configuring routes and registering dependencies. The two approaches we have can be broadly categorised ...
2
votes
0answers
204 views

How to avoid module dependency chain nightmare caused by transitive dependencies?

Many (most?) AngularJS folks seem to advocate for breaking AngularJS apps up into many modules. Brian Ford in his blog already states that packaging by layer (controller, service, etc.) is a "silly" ...
2
votes
0answers
193 views

How can I put multiple hierarchical forms in a single web page and avoid making it a mess?

We are a group of developers working on a web application that accepts forms filled and sent by our users and present it in an overall view. Our main form view looks like this: There are multiple ...
2
votes
0answers
225 views

JS closures - Passing a function to a child, how should the shared object be accessed

I have a design and am wondering what the appropriate way to access variables is. I'll demonstrate with this example since I can't seem to describe it better than the title. Term is an object ...
2
votes
0answers
44 views

How do I differentiate between old and new data in backbone collections?

A common pattern I come across is a backbone collection which is initially seeded from a database. However, the user can also add to the collection. When the user does add to the collection, these ...
2
votes
0answers
124 views

Managing setTimeouts and setInterval in a distributed environment

I am building a turnbased game on nodejs using socket.io and redis as the datastore. I am planning on hosting the game on AWS opsworks with the ability to scale by adding more nodes. How should I ...
2
votes
0answers
232 views

Should I use SignalR to synchronize & cache CRUD data to a mobile app?

I'm considering using SignalR to send data to a mobile app, but need to have a way to synchronize data while it's closed or pending updates. Is it a good idea to use Backbone.js <--> SignalR to ...
2
votes
0answers
146 views

What is a good method of storing test data for development and unit testing with angular and jasmine?

What is a good method of storing JSON data/objects for development and unit testing with angular and jasmine? I have seen some ways of accomplishing this. However, since I am new to unit testing with ...
2
votes
0answers
231 views

Reducing code complexity for an interface between angular and d3

I'm playing around with different ways of integrating d3 and angular, in the context of learning both of these frameworks, and am hoping for some input: My client application receives a JSON array ...
2
votes
0answers
283 views

Reusable and customizable charting library on top of d3js

I have started building a charting library on top of d3js using javascript's inheritance. My goal is to develop reusable and fully customizable chart components. I read the article: Towards Reusable ...
2
votes
0answers
65 views

Reasoning behind indexedDB versioning

So, the last 2 weeks I have been fighting with indexedDB and one of two recurring questions that keep popping up is why indexedDB has to use/present it's entire versioning system? I do understand that ...
1
vote
0answers
226 views

Why is deep plucking a bad idea?

Both underscore and lodash refuse to implement deep plucking, despite many requests from users and gists or modules that implement the feature. ...
1
vote
0answers
260 views

Preserving Pre-formatted Multi-Line Strings in Node.js Scripts

There is a lot I don't like about PHP, but one thing I love is multi-line strings: $query = <<<EOT select field1 ,field2 ,field3 from tableName where field1 = 123 EOT; ...
1
vote
0answers
30 views

modelling an ecosystem evolving on a landscape

I would like to understand a bit more the theory and the approaches available in modelling a population roaming across a landscape. Assume discrete time and space as simple as a discrete grid and a ...
1
vote
0answers
60 views

Need to add websocket support to a single page that's running a wsgi service

Current setup. I have a legacy ERP system (Thoroughbred) and i then have several in house applications (CRM, WMS) and a website that interact with it via an xml server and straight ODBC connections. ...
1
vote
0answers
57 views

Performance increase by only attach onblur handler inside of onfocus handler?

Given a web page with input fields, does it have a performance difference whether or not you assign the onblur handler inside of the onfocus handler like so: var inputFields = ...
1
vote
0answers
322 views

JavaScript program design: to what degree should I separate logic and display?

Consider you wanting to implement a simple game of checkers. There would be a rectangular game board and the player would able to move the pieces around according to a particular set of rules. ...
1
vote
0answers
69 views

Why does JSF not tend to render specific value to constant in some tags

This question is about JSF concepts or architecture; probably I don't understand enough to be more specific. There are some ways to pass parameters to commandLink actionListener. But there are no ...
1
vote
0answers
32 views

Is there a way to handle shared javascript assets in Spring?

I'm familiar with MVC web frameworks and lately very familiar with Symfony2. I want to start learning Spring, and the first practical problem I would like to try to solve is handling the reuse of ...
1
vote
0answers
329 views

Managing Login Authentication/Webpage session: Can client side javascript/JQuery access either a session variable or json variable in html?

Short version: A variable is stored in a session variable req.session.userName and also in the json sent with res.render('/', {username: value}). How can I access either of those variables from inside ...
1
vote
0answers
127 views

Mutual Authentication in JSON or AJAX only?

AFAIK we must install the client-certificate into the users browser to connect with https-sites using server-certificates to have a mutual authentication. What about AJAX and JSON, can we connect to ...
1
vote
0answers
109 views

Using Singletons in JS with workers

I'm building a javascript application that does continuous drawing, but relies on asynchronous scripts in the background which also need to poll for events and write to "global variables". This got me ...
1
vote
0answers
50 views

Scale parts of image to fill bezier path with no wastage

I want to be able to take an image and stretch/contract each pixel row (or 5 rows for performance) to fit within a curved shape. I've been searching for this for the last few days and have turned up ...
1
vote
0answers
129 views

Binding in web frameworks - to frontend data or backend data?

AngularJS and other web frameworks provide data binding abilities (as in WPF). Is the UI bound to JavaScript variables on the frontend (web browser) or is it bound to the data in the server (via AJAX ...
1
vote
0answers
306 views

Should we still care about _escaped_fragment_ and alternate HTML generation for Single Page Applications?

A few months ago I started a project, which will have two parts – business client overview panel (AngularJS SPA) and public front-end (dynamic HTML with progressive enchancements via XHR). I'd really ...
1
vote
0answers
68 views

How do I manage a JavaScript library with TFS?

I know that I can share files between Visual Studio projects using linked files and assemblies using project references. Is there a good approach for JavaScripts? I'd rather not use linked files since ...
1
vote
0answers
143 views

Backbone and JavaScript

I have been programming in JavaScript for just a little over two years give or take, I am still in the intermediate part of the know-how spectrum. I have recently just discovered Backbone and I love ...
1
vote
0answers
228 views

how to integration dynamic web fields and forms

I'm trying to find a way to design backend that will be handling customized web forms creation on the fly. Once created those forms will be injected to part of the existing web pages. I've created ...
1
vote
0answers
95 views

Javascript library for Java source code reference

Could you suggest any JS lib, that will "recognize" all Java classes in specified text and create reference link to page with this class? (similar to Eclipse Ctrl+click) There are plenty of good JS ...
1
vote
0answers
513 views

Best option to send image from javascript client to SQL server

From a client (browser), using javascript I want to send an image to sql server ( and store with user profile) (sql server), along with other data such as user id or name. Which option is better? ...
1
vote
0answers
74 views

reading parameters and files on browser, looking how to execute on server

I have a site done in Rails, which uses javascript to load files and generate forms for the user to input certain information. Those files and parameters are then to be used in a fortran code on the ...
0
votes
0answers
28 views

Hot swapping files and metaprogramming with front-end JavaScript

I was inspired by a video on hotswapping JS files with React + Webpack for the web. I started trying it out with React + Backbone + RequireJS. Seems to work, as long as I stick to the stateless parts ...
0
votes
0answers
58 views

Shared data in functional programming

I have been working on a project in JavaScript which requires a data structure (read only), to be shared between two functions. var mySharedData = ['hours', 'minutes', 'seconds']; Now I have two ...
0
votes
0answers
30 views

Authenticate Joomla User from an External App based on Node.js, Javascript and mongoDB

I have an iOS App which currently pulls in all the data from the MongoDB using a Node JS server. Currently my API / my node server handles all the data manipulation the iOS app/Swift only displays the ...
0
votes
0answers
27 views

Is it better to store integer data or array references in a javascript visualization?

Say I have a tree that I'd like to visualize with d3. Nodes have various attributes produced by the d3 library, attributes like an index and position variables. Now, I could add more attributes to ...
0
votes
0answers
43 views

Is there an algorithm to avoid getting in hundreds of datapoints from API to represent a bar graph?

I am showing a graph on HTML5 canvas using the flot charting library for a between a start date and an end date. It's fine as long as the period is less than a year or so but if the user selects a big ...
0
votes
0answers
52 views

Vertical Single Page App libs/patterns?

Lately I've noticed a trend amongst some website homepages to present information in a vertical fashion, forcing the user to scroll down to continue reading the content. As you scroll down, a state ...
0
votes
0answers
32 views

dynamic api code generation in nodejs

We are using nodejs and cassandra for backend stuff. In past few months we wrote same CRUD code for different apps. I am thinking of some way to automatically generating CRUD code. I came across ...
0
votes
0answers
44 views

Static classes vs prototype classes whats the difference really

I am manage to create both static and prototype classes in this JS code, Keeping in mind that I will always need 1 instance of prototype class "Fruits" here, what benefit could I get over static ...
0
votes
0answers
40 views

What sort of design pattern should I be using here - Tabs Generation

I am fairly new with design patterns, I have been studying them but no practical experience so this is going to be my first try, Graphical representation of GUI is shown in this diagram, Points ...
0
votes
0answers
86 views

Why would I need node.js to run a javascript library?

I'm interested in using sigma.js, and I'm looking at the instructions here: https://github.com/jacomyal/sigma.js/wiki One of the prerequisites is that node.js is installed. If it's a client side ...
0
votes
0answers
126 views

Right way to design javascript flow?

My question is because I believe that maybe there is a better way to design my code when I need to do sync tasks in JS and wait for the response. I'm working on Node and I need to save some data (I ...