We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [javascript]

JavaScript (not to be confused with Java) is a high-level, dynamic, multi-paradigm, weakly-typed language used for both client-side and server-side scripting. Use this tag for questions regarding common implementations of ECMAScript, JavaScript, JScript, etc. JS does not typically refer to its ECMA-cousin, ActionScript.

Filter by
Sorted by
Tagged with
0
votes
1answer
162 views

Modeling JSON with Javascript

Using C# I've modeled a JSON message this way: public class MessageBase<T> { public MessageBase() { this.message = new List<T>(); } public string type { get; set; } public ...
0
votes
1answer
55 views

Breaking apart a large javascript application that uses the object namespacing pattern

I have a mission critical Backbone application built before AMD and CommonJS were widely used. This application makes heavy use of the Object Namespacing pattern, so that that all the views, ...
0
votes
2answers
260 views

Permutations for time in JSON

Let's say that I have a JSON file like at example below. How would I go about finding all possible values of item combination time sums that exist between let's say 00:03:04 to 00:25:55 without ...
0
votes
1answer
179 views

Emulating classes in Javascript

Lets take the following example of inheritance in javascript: var Employee = function(name, salary) { Person.call(this, name); this.name = name; this.salary = salary; } Employee.prototype = ...
0
votes
0answers
602 views

How to design the state tree using redux?

In the last days I have searched for a documenation on how and when is it best to use redux and how to design the state tree. My research ended in the conclution that there is no one currect answer. ...
0
votes
1answer
259 views

Comparison of modern browsers' javascript engine JITs

I understands that most of the recent browsers use JIT compilation to execute javascript. What I do not understand is: which part of javascript is JIT'ed - the script, or the bytecode? Let me explain....
0
votes
1answer
76 views

Recommended strategy for changing javascript UI table library?

tl;dr - On an existing angularjs grid library, am moving to another. Is it better to wipe out as much code as possible and in a sense code from scratch to the same featureset, or work around what's ...
0
votes
1answer
199 views

Understanding streams

I have started learning streaming APIs and I found one of the good documentations here. There was a comparison given by author to demonstrate the effectiveness of the streams. var http = require('...
0
votes
0answers
95 views

AngularJS: cost of deep watching infrequently changed object trees

I am working on a complex widget with a "preferences" object tree with 50-100 objects and 3-5 properties in each object. Each property is watched by Angular and controls how some aspects of the data ...
0
votes
0answers
108 views

coming from java to nodejs whats the convention for error handling logging? e.message or e.stack?

I come from java, when I got an expected error I printed stack traces. I'm coming now to work on nodejs (never really worked on javascript). and in the nodejs project which I need to maintain (...
0
votes
0answers
239 views

Why doesn't Object.prototype.toString produce more meaningful output?

Why doesn't Object.prototype.toString return a string representation of an object? I don't see any use for the current output and it seems that it would be more useful for the toString function to be ...
0
votes
0answers
311 views

validating arguments in javascript constructors

In many cases, it is useful to have a constructor or factory method that validates arguments before instantiating an object, returning a new object if the arguments are valid and null otherwise. But ...
0
votes
0answers
81 views

Localizing a web-app

I'm just having a debate about the best (future-proof, safe, user-friendly, developer-friendly, technologically nice) approach to localization of a web-application. We are using basically processing ...
0
votes
0answers
59 views

Syncing file data and form data uploaded at separate times

I have a web application where users can upload office documents. In addition to uploading files users also specify extra information about them that's not contained in the files themselves but is ...
0
votes
4answers
5k views

Nested For Loops JavaScript

I have an app which gets data from the database (MongoDB) in JSON format. The returned data contains nested arrays and I want to access the values in the nested arrays. The returned JSON format looks ...
0
votes
0answers
248 views

Persisting and manipulating JS ArrayBuffer data on the server

My node.js app has to deal with (sometimes large; a few MB) tables of numerical data. I'm about to use JavaScript's native binary objects for this purpose (i.e. ArrayBuffer and friends), because they'...
0
votes
0answers
139 views

Does the term “readability” refer also to the transparency of code functionality? [duplicate]

Question: Does the term "readability" refer also to the transparency of code functionality? For Example: I read that a downside of Dependency Injection is a sacrifice to readability. The idea being ...
0
votes
1answer
78 views

Connect different programming paradigms in a real app written in JavaScript [duplicate]

I am learning functional programming, working generally with JavaScript. Many things look promising, like immutable data and stateless flow. Now, I want to build quite a basic CRUD app as a pet ...
0
votes
0answers
81 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
1answer
158 views

maintain rate of animation with requestAnimationFrame

I've noticed that HTML game developers are recommending the use of requestAnimationFrame as opposed to a timer for the animation loop. I understand that this can be optimized by the browser, but how ...
0
votes
0answers
143 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 ...
0
votes
2answers
1k views

Is it OK to use Promises for Caching

Is it an acceptable (not surprising) to use promises to cache results? The idea is to generate a promise once, and just return that same promise again on subsequent calls. For example, a getAll() ...
0
votes
1answer
3k views

How to create a JSON or HTML file that dynamically mirrors file directory structure for jsTree 3.0 [closed]

I am looking to create a JSON OR HTML file that will accurately give the folder/file structure for a directory for use with jsTree 3.0 (www.jstree.com). I want to make it AJAX/lazy load so that each ...
0
votes
0answers
84 views

Extension of native prototypes, good or bad practice? [duplicate]

Today I stumbled upon this page on the Mozilla Developer Network. In it, not only it is stated that it's a bad practice to extend native prototypes, but also that there is only one exception to this, ...
0
votes
1answer
595 views

Better pattern than large if/else if/else for checking conditionals [duplicate]

I've got a fairly large set of booleans I'm checking in javascript, and then using them to alter the state of a layout in my React app. The whole thing is unwieldy, difficult to read, inelegant, and ...
0
votes
0answers
876 views

Reason why client-side JavaScript does not allow access to POST/PUT/etc contents

Is there any theoretical reason why client-side JavaScript could not be spec'd to allow for direct access to POST or PUT contents without need for a server language to write it into client-side ...
0
votes
0answers
104 views

Login Tokens Remote DataServer for use in a Javascript/HTML-PHP environment

I've asked this question on stackoverflow, but i think this is a more appropriate place for it. I'm creating an app for iOS, Android and the Web. I created a separate Restful Data Service that is ...
0
votes
1answer
106 views

Does class Availability makes programming as Object Oriented Language? [duplicate]

Does class Availability makes programming as Object Oriented Language ? Most of the people think that if there is Availability Class in a language, then that language becomes Object Oriented. Is it ...
0
votes
2answers
153 views

What is the normative (best) use of Javascript arguments object [closed]

JS offers the 'arguments' object inside of functions to represent all passed arguments. Is there any broadly accepted concept for when/where this should be used? I've seen items like this in the '...
0
votes
2answers
1k views

Confused about javascript module pattern implementation

I have a class written on a project I'm working on that I've been told is using the module pattern, but it's doing things a little differently than the examples I've seen. It basically takes this form:...
0
votes
3answers
306 views

How should I include jQuery in a library?

I'm writing a JavaScript graphing library using canvas which I am licensing under MIT, and I'm using jQuery, as well as a couple of other open sourced libraries, all under MIT. I'm also using bower to ...
0
votes
0answers
621 views

Javascript and SQL Lite (multi browser offline SQL/database query)

I'm in the elections division of my county and am trying to simplify a voter lookup method for our poll judges during election time. Currently we are using a clunky heavy application that the judges ...
0
votes
1answer
722 views

best practice to inter widget communication in javascript

I have quit a lot of javascript widget and I would like to have a good decoupled way to communicate between them. Something like signals and slots in QT probably? Most of my widgets are written in ...
0
votes
1answer
4k views

How to handle mutiple API calls using javascript/jquery

I need to build a service that will call multiple API's at the same time and then output the results on the page (Think of how a price comparison site works for example). The idea being that as each ...
0
votes
1answer
566 views

Send mapped data from server-side code to client-side code

I'm developing a application based on two technologies: ASP.net (SharePoint) and JavaScript. I use server-side code for retrieve data from database and manipulate it whereas I use client-side code ...
0
votes
0answers
219 views

Keeping Backbone model in sync with editable view

I'm making a web form for editing some objects. I'll call these objects Foos. I have a Backbone model that represents Foos. I have a Backbone view that renders an editor form, filling in fields ...
0
votes
0answers
451 views

What is special about JDBC that makes it unlikeable for JavaScript

Quoting from Selenium Architecture A natural implementation would have been to provide a database connection to the underlying data store, using something like JDBC. Eventually, we settled on ...
0
votes
1answer
153 views

Concerning JavaScript prototype and the initial constructor function

I am going through a tutorial on OOP in JavaScript (javascriptissexy.com using OOP in JS: What you Need to know). The instructor is explaining the Constructor/Prototype pattern of object creation. I ...
0
votes
1answer
158 views

Should my statefull widget generate necessary html itself?

What behaviour should be preferred for widget initialization: 1) Required HTML is generated by widget itself: Layout: <div id="my-widget"/> Initialization: $('#my-widget').myWidget(); // ...
0
votes
3answers
1k views

Approach to develop an inline editor for enumerated lists

Background Looking to develop a WYSIWYG editor for ordered lists so that people can directly edit lists of instructions on a web page. Problem The contentEditable attribute is woefully immature for ...
0
votes
2answers
2k views

Is there any way to detect on a website if the mouse has not been moved for awhile? [closed]

I want an element to appear in case the website has not been used for a while and make it disappear after it is being used again. Is there any way to detect on a website if the mouse has not been ...
0
votes
2answers
97 views

Reinforcing Syntax Elements

I am currently learning Javascript, and there is one element of the syntax that I can just not seem to nail down. That element is adding semicolons at the end of each line. I have learned Python and ...
0
votes
1answer
191 views

Using custom mime type for drag'n'drop events or data attribute dilema

I am having a dilema on a html/js application I have been requestyed to handle drag'n'drop events in order to display a dropped image in a div if is not from images that are already displayed in my ...
0
votes
1answer
791 views

AngularJS and NodeJS required version

I am new to the world of Javascript and their frameworks, and I feel a bit lost with this. I am trying to follow the official toutorial of AngularJS. In one of the first sections, it reads Install ...
0
votes
2answers
479 views

Creating a web application to concatenate strings to unify naming conventions

I've been tasked with creating a small web application, where users have a series of forms (I can't currently think of a better way of doing this) which will contain, either a)text input fields or b)...
0
votes
2answers
86 views

JavaScript Callbacks before or after exiting function?

Is there a concrete reason to prefer executing callbacks to functions before or after exiting the called function? Example function doSomethingPossiblyAsync(callback) { if (...
0
votes
2answers
610 views

Strategy for reading and understanding Node.js code [duplicate]

Concretely I am looking at this 2000 line file of what I will pretty arbitrarily call "mediocre" code. It's not well-commented variable names and function names seem consistently intelligent ...
-1
votes
2answers
462 views

DMCA as a license for closed-source javascript code [closed]

I have a proprietary project, with parts of it written in javascript. We would like a software license to include in the header file for this code which ensures the work remains: proprietary cannot ...
-1
votes
3answers
9k views

Alternatives to Java Applet for interactive Websites [closed]

In short I am searching for an alternative to Java applets for making some interactive parts like minigames etc. on my website Facts: I´m developing an e-learning website for children. This site has ...
-1
votes
3answers
2k views

Are browser console errors 'compiler errors', 'runtime errors', or neither?

I was trying to communicate with a coworker about a JavaScript error I was being notified about in my browser's console window when I realized that I wasn't sure if I should refer to this as a ...