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.
1
vote
0answers
23 views
Order and filter Server-Sent-Events in angular.js eventsource
I have a Client in AngularJS where I consume multiple SSE (Server-Sent-Events) in Java from the Server Side (there are multiple endpoints in different web servers in the backend). Diagram link
I ...
4
votes
1answer
70 views
Is a promise-aware eventing system desirable?
I'm fully aware that Promises and eventing are both ways to do asynchronous programming, and you can choose either one for a given project. However, in practice, the code base I'm working with is ...
-3
votes
0answers
39 views
Chrome Extension - Design patterns [on hold]
I will start with the development of Chrome Extension that is somewhat complex.
I would like to organize the code in MVC pattern style. The View is probably not that important but I would like to ...
0
votes
0answers
28 views
Is the Afferent/Efferent coupling metric relevant in (react) javascript?
My Chief Architect just asked me to add this to a frontend single page app written with React.js. I had a quick look around, but it looks like the tooling (and concept) is more related to true OOP ...
3
votes
2answers
82 views
How do services that rely on client-side access to an API or data consumption endpoint prevent abuse?
For example, web application monitoring services like New Relic RUM or Bucky use JavaScript to collect data on a user's session and eventually send that data back to an endpoint. For New Relic, the ...
0
votes
2answers
72 views
Managing session timeouts with regards to user activity in the page
So I will be creating a feature to a php application that does the following:
Create a session that expires after 30 minutes.
After 30 minutes, if there is no user activity in the application (...
11
votes
3answers
583 views
I'm losing track of the flow of my PHP web app, it's becoming hard to work with
I've been programming for a few years, and have become very familiar with C# and JavaScript over time. I have some larger C# and JavaScript projects that I have no trouble navigating around. I ...
0
votes
3answers
274 views
Efficiency of nameless functions
The current trend seems to be to use lambda type function in languages that can take that syntax. Is this just a trendy thing or is actually more efficient? eg in javascript, you can get stuff like
...
0
votes
0answers
36 views
Importing functions from modules in Python and JS
In Python importing just one function makes no performance benefit as pointed out in this question.
However, in JavaScript things are completely different, or at least I often see people do it and say ...
0
votes
1answer
84 views
What native JavaScript functions/methods/properties/operators can return null? undefined? [closed]
I'm writing some code that needs to deal with many potential JavaScript values including so-called non-values . I'm realizing it would be very helpful to know if there are some general rules about ...
6
votes
3answers
425 views
“Comment everything the right way” and “Instead of writing comments, write more readable code.” - Both valid strategies?
When trying to learn about proper comment practices, I found a lot of conflicting opinions, and it's obviously a very subjective topic. So I'm not going to ask "Should I comment, or should I not?"
...
0
votes
0answers
38 views
managing complex web forms
I work on an application, the core of which is a very complex set of web forms. The source of this complexity
scale, some forms contain about 50 pages, which up to 30 questions on each page
complex ...
0
votes
1answer
45 views
Understanding webpack and other module loaders
I am a bit confused regarding module loaders Like I am using webpack which load modules as chunks but it is only while developing When the code gets minified it will be a single file for all scripts ...
1
vote
0answers
19 views
Why is a monad prototype required for Douglas Crockford's monad demo code? [migrated]
Note: while the code in this question deals with functional programming/monads, etc., I'm not asking about functional programming (nor do I think this question should have tags related to functional ...
1
vote
1answer
44 views
How to preserve parameter names when using bind to define new methods
I'm writing javascript object that wraps REST requests. For every operation on the server there is a method that accepts the parameters for the request and a callback that will receive the results. (...
-1
votes
1answer
94 views
Javascript: Invest in ES6 or learn prototype fundementals [closed]
As a budding software engineer, what is worth time-investment in terms of Javascript? I'm interested in long term payoffs in terms of a deeper understanding of languages, tech, software engineering, ...
0
votes
0answers
46 views
Front end code and quality [duplicate]
I'm a software developer since 3 years and I'm really interested in Javascript since ~1,5 years.
I have a backend profile at first, and I'm familiar with SOLID, DDD and some other kind of making code ...
0
votes
0answers
55 views
designing better and crisp server.js (the file which is called to start node application 'e.g. node server.js')
While creating server.js file we need to provide routes information as
var Login = require('./routes/login.js');
app.use('/login', Login);
Now, suppose the node project is a REST services project. ...
0
votes
0answers
95 views
Is there a way to use html5 custom elements without javascript?
I know requiring javascript on a webpage has been a hot topic the last couple years.
I'm wondering if someone wanted to use custom elements but still allow the website to be usable without ...
0
votes
0answers
86 views
What is the fastest way of using conditional in Javascript when comparing multiple strings?
I have a piece of code that looks something like this
var abc = function(pathin, pathout)
{
if(pathout === "bcd/fgh" && pathin === "egh/abcd/gh")
{....}
else ...
0
votes
3answers
158 views
PHP/JS software copy protection
First of all I know nothing I can do that 100% prevents illegal copying of my software. I'd like to just make it reasonably hard for a competent person to do, and almost impossible for an ...
1
vote
5answers
187 views
Where to declare a variable and define a function in Javascript?
I'm reading the book JavaScript: The Good Parts.
On page 113 it recommends function expressions instead of function statements, because statements are subject to hoisting:
The statement:
function ...
0
votes
0answers
55 views
Correct way to geo query
I am currently using firebase which limits me to simple queries and because I want to avoid using geoFire's keyEntered way of handling geo queries I've decided to try my hand at my own (naive) ...
-3
votes
2answers
85 views
How to improve this algorithm to use three loops only? [closed]
I want to print all four digit numbers in format ABCD such that A+B = C+D (known as “happy numbers”) with three nested loops. Here is the original code:
for (let a = 1; a <= 9; a++)
for (let b ...
0
votes
0answers
23 views
WET logger function in javascript, how to avoid dependence on scope?
I have a set of functions (in aws lambda) and I find myself repeatedly typing out a nested longer function, but I can't think of a way to abstract it as it needs to take only two arguments but depends ...
0
votes
0answers
34 views
In browser form validation in laravel
In laravel 5 I describe models without specifying fields in model class. Some magic identifies which fields exist in database for this model.
use Illuminate\Database\Eloquent\Model;
class MyModel ...
1
vote
0answers
52 views
SystemJS Transpiler - where would it be used
I'm creating a project which uses SystemJS/JSPM.
I'm also using TypeScript.
Now TypeScript has the option of compiling JS using SystemJS Modules - which I'm doing and all is good. I've created TS ...
1
vote
2answers
62 views
Is there any reason to use testing frameworks instead of assert for a lightweight lib of pure functions?
I've just written a simple mathematical library which consists of pure functions that take a few arguments, do some computation and return a result. I'd like to write unit tests for this library, but ...
4
votes
1answer
169 views
Are there any scenarios where a JS function expressions would need to refer to its “name”?
Anonymous function expressions in JS bug me as they make stack traces and Chrome Dev Tools profiler output harder to use, so I've decided to name ALL my function expressions from here on in. The ...
149
votes
8answers
18k views
Developing web applications for long lifespan (20+ years)
I'm currently developing a web application for government land planning. The application runs mostly in the browser, using ajax to load and save data.
I will do the initial development, and then ...
0
votes
0answers
69 views
Should I replace native JavaScript exceptions with a foreign concept?
I have a case where I would like to avoid using exceptions for validation errors in my function's callback parameter. These errors are not really exceptional, and try...catch can prevent a JS engine ...
-2
votes
1answer
42 views
Adobe Acrobat folder level scripts
I am trying to find ínformation on how and where to write folder level scripts for Adobe Acrobat and Adobe Photoshop. This is what I found from Adobe:
https://acrobatusers.com/tutorials/...
91
votes
3answers
13k views
Why do Trampolines work?
I've been doing some functional JavaScript. I had thought that Tail-Call Optimization had been implemented, but as it turns out I was wrong. Thus, I've had to teach myself Trampolining. After a bit of ...
2
votes
1answer
189 views
What is this deviation from Dependency Injection called?
Looking into Dependency Injection in JavaScript, as with Angular, I decided that true DI was overkill for my medium sized project, so I worked on a simpler way to organize my project and implement ...
1
vote
0answers
54 views
Putting NoSQL DB schemas on front-end, safely
We are using Firebase which is probably similar to MongoDB in that it stores arbitrary JSON structures. We are also using Node.js and so the library in question could in theory be used both backend ...
3
votes
1answer
97 views
Javascript / Ecmascript language grammar disambiguation
I'm working on the design of a compiler for a language in which I have to use curly brace for two different purposes. I am currently stuck in writing a non-ambiguous grammar but I realized that some ...
2
votes
1answer
116 views
In a JavaScript method signature what is meant by a return type of `typeof blahBlahBlah`?
I've seen an API list methods with both of the following signatures:
methodA(...) : ReturnType
methodB(...) : typeof ReturnType
I understand the first but not the second.
My question comes ...
3
votes
1answer
113 views
Misunderstanding of viewmodels relations on client and server side
I have basic viewmodel on server-side, let it be on C# language and ASP.NET Core server-side, for example:
public class BookViewModel
{
public string Id { get; set; }
public string Name { ...
3
votes
1answer
97 views
Why use an iterator/generator for lazy evaluation implementations?
This question may apply to other languages but it is explicitly about JavaScript.
I've been trying to write a lazy evaluation implementation to filter through an array of elements. The filter process ...
1
vote
1answer
68 views
Using a try/catch to deal with deep object drill downs that will often fail
I have
try{
var progress = raw_progress[module_id][modulette_id][tab_id][track_id];
if(progress.started){
count += 3;
}
if(progress.complete){
count += 3;
}
...
0
votes
0answers
33 views
Reaction Time Test Website Advice
For my Peace and Conflicts study class research paper, I want to make a website similar to this one: https://implicit.harvard.edu/implicit/ which tests people on reaction time.
The basic way this ...
4
votes
2answers
173 views
Stopping client-side Javascript from turning into a monolith
I'm developing some Javascript front-end code using JQuery with some back-end JSON webservices. IDE is Netbeans, and debugging using that and Chrome.
Coming from a C++ background I'm used to small ...
4
votes
1answer
163 views
Are generator functions valid in functional programming?
The questions are:
Do generators break the functional programming paradigm? Why or why not?
If yes, can generators be used in functional programming and how?
Consider the following:
function * ...
1
vote
1answer
78 views
When/how is it okay to redefine/declare variables? [functional]
I've been learning functional programming in javascript of late, and there's one thing that's been confusing me. I can't quite understand if it's ever okay to redefine variables.
Something like: a = ...
0
votes
1answer
37 views
Abstraction in Cordova
Recently, I have been coding in Cordova a lot for the company I work for. For those of you who don't know, Cordova is a cross platform development tool for mobile applications which is web based. ...
1
vote
1answer
135 views
How does mouseevents works?
You could setup special mouse events using Javascript that fires when the pointer is enter or hovering over a specific HTML element (i.e: object.addEventListener("mouseover", theScript); ). But how ...
1
vote
2answers
181 views
Reaching back up into the parent class
I have an app with the following structure (simplified a bit here)...
var RecorderApp = function(canvas) {
this.state = undefined;
this.states = { record: recordState, save: saveState };
this....
0
votes
0answers
37 views
Method using Object.observe to recalculate result on receipt of data from TCP socket?
Just stumbled into programmers and though to ask this question. I am developing a nodejs application to calculate the time difference from incoming data from a TCP Socket. Each data consist of this:
...
2
votes
1answer
216 views
Are Native Promises Still Slower in Node vs Libraries such as Bluebird? [closed]
Does this question still apply: Why are native ES6 promises slower and more memory-intensive than bluebird??
In regards to the latest versions of Node.js and EC7?
0
votes
1answer
76 views
Name a predicate function that takes multiple objects [closed]
I have the following JavaScript code:
function tokensOnSameLine(node1, node2) {
return node1.line == node2.line;
}
What would the preferred name for this function be? I've considered the ...