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.
0
votes
0answers
11 views
How to set the cursor position in nsIEditor/nsIPlaintextEditor via javascript in a Thunderbird extension?
I'm trying to create a simple Thunderbird extension which operates on plain/text messages when replying to a message. After applying modifications to current editor's content I need to place the ...
7
votes
5answers
499 views
Why JavaScript? What's the advantages? [on hold]
This is not a simple question, but I was thinking, what advantages are really there in the JavaScript language?
We all use JavaScript on the browser, of course, there is no other choice (you can use ...
-1
votes
1answer
49 views
keeping of all javascript functions in one place
In php website I am using different javascript functions in different pages for example page a calls functions 1,2,3 and page b calls functions 2, 4, 6 and page c calls functions 3, 6
can I place ...
1
vote
1answer
71 views
Calculating winning probability for 2 teams using their history?
So I'm working on this project where I have a database full of team winning history. For example let's say these are all football teams. Every match has 2 participants (2 teams) and always a winner.
...
0
votes
1answer
77 views
Does streaming video pass through the website's server when embedded with javascript from another site?
Not sure how else to phrase this question, so my apologies if it's been asked before.
We use Brightcove for streaming video. They offer an option to embed one of their players on your webpage using ...
-5
votes
0answers
34 views
Inline java script in knock out templates [on hold]
I am working on a single page web application. We are using knockout bindings and templates extensively. I am trying to place some inline script in templates. But surprisingly I am seeing inline java ...
-2
votes
0answers
30 views
Is it good choice to use Adobe Air (html & Javascript) to develop Point of Sale system? [on hold]
Is Adobe Air (HTML & JavaScript) a good technology choice for developing a restaurant PoS system? Is there any shortcoming? :
We tried out Adobe Air (HTML & JavaScript) and SQLite for desktop ...
0
votes
0answers
76 views
Executing javascript on GPU [on hold]
I have found this document, which speaks about the library parallelJS. It should be able to compile javascript code in GPU (see schema).
But the only library called parallelJs found allows "only" to ...
0
votes
2answers
193 views
Is there any plan to take out “features” from next versions of javascript? [on hold]
I'm looking to learn javascript (now for real) and I've had a look on the latest version of ES6 which is supposed to be frozen in terms of features set.
It seems to be the pretty much same as ES5 ...
2
votes
1answer
87 views
Would there be any benefit to writing synchronous code using the syntax of promises
Is there such a concept as a synchronous promise? Would there be any benefit to writing synchronous code using the syntax of promises?
try {
foo();
bar(a, b);
bam();
} catch(e) {
...
-2
votes
0answers
37 views
Node.js to connect two APIs? [on hold]
I'm looking to build a service that connect REST API's from two web services I use. (Trello.com & Wunderlist.com) They both have REST API's with JSON outputs, and as I understand it node.js would ...
0
votes
0answers
6 views
AppleScript File Deletion Question [migrated]
Brief description of problem: iTunes Match decided to re-download all of my songs into its automatically organized file system in the Music subfolder of iTunes on my Mac. So the folder for a song ...
-4
votes
1answer
111 views
Why doesn't v8 compile typescript instead of javascript? [closed]
Since Typescript is just a superset of javascript (every javascript program is also a typescript program), I've got this idea - why doesn't v8 support typescript? or anything statically typed ...
2
votes
1answer
88 views
Need an algorithm to filter this collection format
I'm sorry the title is so vague ... I cannot think how to describe it any better.
I have a collection in this format:
var myCollection = [{id:"a"}, {id:"b",excludes:["a"]}, {id:"c",excludes:["b"]}];
...
-4
votes
0answers
30 views
CKEDITOR and angular version conflict [closed]
I am trying to embed ng-ckeditor in my angular app. However, I kept on getting an error message stating the module could not be instantiated. While I am sure I have injected ngCkeditor to angular's ...
0
votes
0answers
53 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
124 views
Best Data structure for implementation of dependent drop-downs
I want to implement dependent drop-down feature on a web page in my website containing the following drop-downs:
User's group name
Group events (dependent drop-down)
Locations (dependent drop-down)
...
1
vote
1answer
174 views
How to merge two functions that do same things with different variables
I have these two Javascript functions that are equal except for the variables
onClickVoteUp: function (e) {
var $target = $(e.target);
var upvoted = this.model.get("upvoted");
var ...
-1
votes
0answers
7 views
Using GreaseMonkey to change Javascript variable [migrated]
I've got a question regarding a website that I use quite frequently. The website is essentially a browser-based air traffic control simulator. The page uses a php script to load the JavaScript ...
5
votes
1answer
120 views
Is it poor decision making that using promises for GUI inputs?
So as you know the context: DOM with JavaScript, even though I think it is mostly a language agnostic issue (I know I put both language-agnostic and JavaScript tags, but it's only to let you see ...
3
votes
3answers
177 views
Anything wrong with direct evaluation of JSON if your own code created it?
Suppose I have a server-side variable containing JSON (named strJSON) that my own code created. In JavaScript I can consume it like this:
var data = <%= strJSON %>;
or use a JSON parsing ...
1
vote
2answers
71 views
Observer pattern: Prevent multiple firings on changed internal property
I have an object Foo that has 2 public properties: A and B.
These properties can be changed from outside, as the application I'm working on is using a data-binding architecture. This is the ...
2
votes
1answer
121 views
Declaring JS Functions in Two Ways : What's the Benefit?
I've come across JS code in which I see functions being declared in two different styles:
Method 1
function doSomething(){
alert('This is one way of declaring a function');
}
Method 2
...
1
vote
1answer
76 views
Assigning default values from environment variable in Node.js
When attempting to set default values for parameters that may exist in environment variables in JavaScript, I often see this pattern:
var lag;
try {
lag = process.env.THROTTLE_LAG;
}
catch ( e ) ...
0
votes
0answers
36 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;
...
11
votes
2answers
298 views
Is there any reason to use the “var” keyword in ES6?
Babel's guide to ES6 says:
let is the new var.
Apparently the only difference is that var gets scoped to the current function, while let gets scoped to the current block. There are some good ...
-1
votes
0answers
30 views
How to create “fuzzy” material design type shadows on a canvas? [migrated]
I can't seem to find out how shadows are created in material design, or how css does it. Specifically, I am curious how, if given a canvas, one would create the 'blur' part, using algorithms. Below is ...
0
votes
0answers
25 views
Better pattern with promise code [migrated]
I'm programing server side node for a huge project. And I'm thinking my brains out about the best programming pattern that will be suitable for fast modification and changes.
Tell me what you think ...
2
votes
0answers
34 views
Correct Approach to Refactoring to Promises [migrated]
I am in the process of refactoring some complex code that uses callbacks to instead use promises. I am trying to figure out if my proposed approaches make sense. I did not think this was a good ...
2
votes
1answer
74 views
How to deal with server-side and client-side naming conventions that clash? [closed]
I have a project that uses the underscore naming convention for the MySQL database and PHP scripts but uses camelCase for the javascript application (a common scenario I'm sure).
However, once JSON ...
2
votes
3answers
165 views
With only backend development experience, how do I go into frontend development (js, html, css)? [closed]
Currently I am interning at a company as a "full stack" developer (Application developer on the job title) and I realize that I am having difficulties coping with frontend tasks. This is especially ...
0
votes
1answer
129 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 ...
3
votes
1answer
225 views
What is the most efficient / fastest way to keep a list in order?
I implemented Dijkstra's path finding algorithm in JavaScript and a big part of it involves storing the distances to nodes and fetching the smallest. The distances change often and the smallest is ...
2
votes
1answer
48 views
How Javascript Engines access/lookup property names?
How Javascript Engines access/lookup property names? what kind of associative array (data structure or search/lookup algorithm) did they use? (for V8, TraceMonkey, JSC, and Rhino)
For example, in C++ ...
2
votes
1answer
71 views
The meaning of 'fully traversable namespaces' in JavaScript
During research into architecture of single page applications, I came across the following resource by Mikito Takada, written around 2013: http://singlepageappbook.com/
In his introduction he ...
2
votes
1answer
130 views
Does react.js make sense for a static content-driven site?
I'm pretty sold on the react.js model because it makes DOM manipulation so smooth and comprehensible. But I'm wondering how it could be leveraged for a site that's largely static with big blocks of ...
16
votes
1answer
700 views
When to use prototypical programming in JavaScript
I've spent a good bit of time developing simple widgets for projects in the following way:
var project = project || {};
(function() {
project.elements = {
prop1: val1,
prop2: val2
}
...
0
votes
0answers
23 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 ...
-4
votes
0answers
21 views
PDF popup in Mozilla [migrated]
I have a PDF file generated through jsPDF. When the file opens in Mozilla, a popup windows appears as attached:
I would like to put some meaningful description there instead of "blob". How can I do ...
4
votes
1answer
146 views
Does HTML 5 undercut the need for a full-featured Javascript framework? [closed]
We're redesigning a website. Right now it uses Dojo, a large (and complex) Javascript framework. One person insists that we need Dojo because of things like (random examples) client-side ...
5
votes
2answers
461 views
Where is the evidence for the performance of Node.js?
A lot of developers, especially ones who haven't used Node.js in production, seem to believe that Node.js is faster than other interpreted languages such as PHP, Python, and Ruby.
These claims ...
0
votes
1answer
72 views
Should I prefer classes or singletons in JavaScript/Node?
This question applies especially to Node.js, but also to JavaScript in general.
I started working on a simple web app in Node.js. I'm relatively new to Node and JavaScript, and come mainly from C# ...
2
votes
0answers
119 views
Deleting all cached page of the site [migrated]
Scenario
Mobile and desktop version.
I'm developing a website with a desktop and a mobile version: users can choose to switch version if they want to: javascript will save a cookie telling the ...
5
votes
3answers
229 views
Is prototypal inheritance inherently slower?
I see Javascript 6 will add traditional class based inheritance, and one argument I hear is that classes are inherently much faster than prototypes because they can be optimized away by the compiler ...
0
votes
1answer
87 views
Multi Room Chatroom Architecture [closed]
I'm building a multi room chatroom app, with some extra features that go beyond a few methods/calls.
I'm wondering if I should:
Manually create every method call on the clients and servers, which ...
0
votes
0answers
25 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
2answers
73 views
Literal strings vs. object properties in JavaScript
JavaScript libraries in the same space (UI widgets) use two different approaches for instantiating components:
Literal strings to specify types, and inlining as much as possible, for example:
var ...
1
vote
2answers
80 views
How to make scalable modules in a div element
I'm interested in creating web modules that are encapsulated by a div element in a manner that, by simply resizing the div, everything in that div scales to the dimensions of that div proportionately ...
0
votes
1answer
42 views
Measure and locate areas of similar value in an image
I saw this picture online and wanted to see if I could create an algorithm to give ordinary images an effect like this:
http://justinlivi.net/wp-content/uploads/2011/01/Living_In_Digital.jpg
My idea ...
3
votes
2answers
135 views
Why is the Document Object Model the view?
I was told by a Javascript programmer not to do DOM manipulation in model code.
I also remember hearing a snazzy tune for a JS framework (I forget which one): "Get your models out of the DOM".
This ...