The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
1
vote
2answers
36 views

Node.js error handling through each layer

I am looking for a way to handle errors in a Node.js application without getting lots of log entries for the same error event, one from each each affected layer. This might actually apply to any ...
-4
votes
0answers
12 views

Nested Json response from NodeJs and MySql

I have 3 Mysql tables, a vendor table with a list of vendors, a categories table with a list of categories that these vendors have in there stores, the categories table is linked to to the vendors ...
-2
votes
0answers
59 views

What is a good way to structure a web site as part of a bigger site?

OK, I have a abstract question what ways you suggest to structure a subproject of a existing website. I first describe what I have and what I want to achieve: There is a homepage in a CMS (Joomla) ...
1
vote
1answer
43 views

Transpiling in npm modules

While recently creating a module for shared functionality between our projects I stumbled upon this question. Should the module be occupied with transpilation of code to older browsers that our ...
2
votes
1answer
88 views

Domain classes in DDD structure in React apps?

I'm building an Electron app using React. I'm coming from the C# and WPF world and I'm wondering, where should my domain classes go? I understand the concept of components, but what about a class with ...
110
votes
3answers
39k views

Benefits of Structured Logging vs basic logging

We're building a new app and I'd like to include structured logging. My ideal setup would be something like Serilog for our C# code, and Bunyan for our JS. These would feed into fluentd and then could ...
2
votes
1answer
409 views

Describing JS program flow in @fileoverview

I have to edit other people's JavaScript code. The code usually loads some data from a Web API, generates a table, places it into the HTML page, and attaches some event handlers. Due to the async ...
0
votes
2answers
91 views

How can I emulate Signals and Slots found in Qt, to Javascript / Typescript Classes?

Ive brought this up with other developers, and they say while there is no obvious way forward, it seems that they all have an idea of how to go about it. Is there any way I can implement signals and ...
0
votes
0answers
37 views

React CRUD patterns

My strategy with react forms has always been (psuedocode): CreateFoo - simply hooks up redux actions to save new record - onOk = (draft) => dispatch(addFoo(draft)); - return <FooForm onOk={...
0
votes
0answers
47 views

Ist good practice adding Converter Between api and client

I just want to curious about adding a converter is a good practice or not. I have multiple API and I always convert API return fields to my client fields. Like=> function ConvertFromAPI(apidata){ ...
2
votes
2answers
76 views

What is an example, in Javascript, of the difference between Abstraction and Indirection?

I thought I understood what abstraction meant - refactoring code so that it applies to more general use cases. However I have recently learned that some types of abstraction may actually be ...
6
votes
2answers
2k views

Nested classes via a getter (to emulate namespacing)

So, we all know that ES6's introduced syntax is definitely sugar over what we've been doing, previously. That being said, we still don't have namespaces (which would be nice...) The problem that I'm ...
-3
votes
0answers
76 views

Is Web Assembly able to multithread?

Javascript can not multithread, and to the extent it does, it is done with something called "workers". Will this be the same with WebAssembly? Why or why not?
2
votes
3answers
759 views

Any reason to not use a triple not?

If logical not ! will switch a boolean value from false to true or true to false and a double not !! will cast a value from one primitive type to boolean is there any reason one can not use a logical ...
0
votes
1answer
71 views

Allowing a user on one page to be able to cause an event on another

I would like to allow a set of users to be able to submit a form on one page, and then it would cause an event to trigger on another page. For example: Submit Page: Includes the form, the user ...
2
votes
1answer
31 views

Best practice in synchronized form data validations (Web apps - Client-Server)

Here we go again with topic what was asked many times all over internet, but I not found any good enough answer: What are best practices in making client and server side validations synced? I was ...
3
votes
0answers
83 views

data transfer objects between abstraction layers

I want to create an Express REST API and want to try following the clean architecture ideas. I was reading about it but didn't get the idea of the communication between the abstraction layers. Let's ...
-4
votes
0answers
40 views

how can i strip everything out without using regex

I have an XML that is being sent to an API endpoint to trigger a process in Dell Boomi. However, when I upload the file via a web page it ends up having the Content-Disposition and other stuff that ...
-1
votes
2answers
86 views

Notify thousands of clients with websockets, are there any caveats?

I'm building a web app, where users can create locations, which are displayed on a map. Also, users can click on the map objects in order to get to a place details page where further interactions ...
0
votes
1answer
26 views

Passing javascript function vs use imports in Svelte or React component

I wanted to use some function from javascript module in one of my component. Should I pass it in props when making the component or should I just use Imports in component itself to get the javascript ...
0
votes
0answers
24 views

Methods for storing data pre-registration in a web app

I have a web app - it's more complicated than a todo list but for simplicity sake let us assume it is a todo list. The user has the choice to sign up and create an account thus allowing them to store ...
3
votes
1answer
182 views

DDD / Onion architecture in JavaScript

One reason I like .NET is because the 'solutions' and 'projects' lends themselves to good architecture. Good architecture makes it easy to follow the happy path of Domain-Driven Design. I've fallen ...
5
votes
3answers
3k views

What JavaScript inconsistencies should I look out for? [closed]

I remember reading some "funny" examples once of weird results JavaScript can give when you, for example, add strings to numbers etc. Does anyone have any good examples or a link to the blog that I ...
-7
votes
6answers
13k views

How to not let anyone inspect elements of a webpage?

I was thinking to make some jQuery functions that will use ajax to control mysql. The whole idea is to make separate files of PHP (e.g query.php, addRow.php, update.php and delete.php) provide data to ...
3
votes
2answers
834 views

What is a good method of storing test data for development and unit testing with angularjs 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
1answer
95 views

Is this the right way to handle errors using the fetch api?

I am using the fetch api in my handleSubmit function in a React component to post data like this: handleSubmit(event) { event.preventDefault(); var error = false; var { username, password } = this....
0
votes
1answer
24 views

Contemplating about API design of a typescript/nodejs library for querying a remote storage service

I am working on a Typescript library (to be used by many users within my org, possibly open-sourced) which provides access to some remote storage. I am contemplating between several variants for the ...
0
votes
0answers
24 views

Confidentiality concerns in including all state+actions crash report

I am working on creating a method to send crash report details for an Office Add-In created with Redux. Because of the way Redux works, it is possible to get the entire application's state as well as ...
0
votes
3answers
2k views

Should I generate GUID/UUID on client or server?

I want to generate a GUID/UUID for my web app to use but I'm not sure if I should generate it on the client or server or what should be the preference. Basically, I'm working on a web app similar to ...
0
votes
0answers
12 views

Jest + Puppeteer : Testing E2E javascript component

Prelude: I have a tags input component, (in vanilla javascript), which triggers callbacks for different scenarios such as: adding a tag, removing, editing etc. The problem: Jest+Puppeteer doesn't ...
0
votes
1answer
63 views

Cross-domain data binding

I've been developing several front-end web-applications recently that bind against a database using a RESTful CRUD api. I've noticed a massive amount of boilerplate code going into defining the API. ...
1
vote
1answer
1k views

Angular2: Service architecture + error handling

I need support for Angular2 service architectures. I am quite familiar with Angular2 but I don't see the best way to implement services, error handling and their connection with the components. I'm ...
3
votes
4answers
660 views

How to do BDD for CRUD?

I want to understand how Behavior-Driven Development (BDD) can be applied to building CRUD applications. I have read a lot on the subject but I just don't get how I'm supposed to apply it. I learn ...
1
vote
2answers
189 views

Is `this` in JavaScript an example of dynamic scoping?

Variables in JavaScript are lexically scoped. But, I wonder, is the this keyword, referring to the receiver of a method, an example of dynamic scoping. Or is this unrelated to the lexical/dynamic ...
1
vote
2answers
839 views

ModelState Validation vs JQuery vs Remote

I was stuck with some validations for quite a while. I have been thoroughly searching the internet to find ways to apply the validations I require. I came across many methods for validations even ...
1
vote
1answer
1k views

Efficient development process for Golang (or any backend) and JavaScript?

I am developing a web application. The frontend is a mix between JavaScript and server-side generated html. The backend is written in Golang. Might not be very important, but if somebody made a ...
0
votes
1answer
141 views

What would be more efficient, move DOM elements or clone them?

I have this dilemma, I have to make a menu, the basic estructure is four to six main menu items and each one can have N level 2 menus and each sub menu can also have subs. I get from the server this ...
1
vote
1answer
63 views

Dynamic execution of Template Literals using a Map

I have a system that is generating internal events for objects. I am extending their debugger to display a human-readable version of the events sent to the debugger. For instance, the system will ...
0
votes
1answer
280 views

Organizing reducers in Redux

I will use the following popular todo list example for demonstration. Let's say I wanted to create a very basic todo list with this structure as the app state: { todos: { todoKey1: { ...
7
votes
1answer
762 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 ...
3
votes
1answer
878 views

Collecting user input to use as query with API

I'm attempting to collect the user's input and execute a search using an API. At this point, I can use the API (ebay search) by typing keywords into the html document- but I want the user to be able ...
0
votes
1answer
91 views

Does it make sense to write one unit test and loop it through similar components?

I have a situation where I have different forms, each with 4 or 5 steps (components), and I decided to write one unit test per step. After doing it, I noticed they were very similar and I could just ...
0
votes
2answers
76 views

Common header file for C++ and JavaScipt, redux

I've got a question closely related to this one. I'm cleaning up a colleague's mess, and I'm afraid that that means trying to work with a language -- JavaScript -- that I'm almost completely ignorant ...
4
votes
2answers
2k views

Linking service and factory functions to controller $scopes in AngularJS

I'm trying to keep my controllers as thin as possible, so I keep my domain logic in services and factories. When I need to call a function in response to a user action like a click I assign the ...
0
votes
2answers
219 views

Architectural Problem in use of ToneJS with Vuex

I'm using the Tone.js library to build a (music) sequencer in Vue+Vuex, and have encountered this problem: Individual music tracks of the sequencer are created dynamically, so I'm storing objects ...
2
votes
0answers
36 views

Send push notifications from ActiveMQ

I am trying to figure out how to send push notifications back to the client in the following ActiveMQ scenario: I have a spring boot web application #1 deployed on tomcat on RHEL server. From the ...
2
votes
4answers
220 views

Should one-line functions be avoided in jQuery/JavaScript?

So, I had a coworker complain about how I made the following code: ... var foo = getKendoDropdown(window.foo); var bar = getKendoDropdown(window.foo); var sna = getKendoDropdown(window.sna); var fu = ...
0
votes
0answers
35 views

Classification of methods that are only accessible by a child class and its parent

I'm trying to document some of my JavaScript according to this JavaScript Documentation guide and came across member access (private, public, protected). I was wondering what the classification would ...
0
votes
1answer
52 views

Interruptible parsers in Javascript

I’m trying to write a parser in JavaScript that is able to be interrupted by the fact that the entire input source is not available during the parse. When subsequent chunks of the input become ...
0
votes
2answers
98 views

Temporal coupling vs. complex constructor

I'm working through a book on writing Single Page Applications in Vanilla Javascript. (I'm working on a project where I'm not allowed to use React or any other frameworks, so I'm trying to get better ...