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
187 views

How to handle “animated” game where the visual should “animate” instead of abruptly change?

I've been playing around and learning javascript/KineticJS by making some simple games (think like board games). I have the game model that is relatively logically simple. When a "move" is given to ...
0
votes
1answer
427 views

Licensing: source code vs. production code in JavaScript

For commercial and licensing purposes, what is the correct wording for differentiating JavaScript source code (written by the programmer and including comments) from the minified version used in ...
0
votes
2answers
113 views

License for free but restricted software sharing

I have built a JavaScript library that I'd like to release for free within my user community. However I want to keep it under control, and not allow my users to pass it on to others without my ...
0
votes
2answers
434 views

Encapsulate external JavaScript library

I am about to develop a ASP.NET MVC 4 project that will make use of maps. Our company has it's own map API which is very basic at the moment, but is intended to be further developed in future to match ...
0
votes
2answers
294 views

What is this variation of MVC in JavaScript?

I am working on sorting out my Javascript code. Currently I have views implemented without any Model or collection. Now I working on separating Model from View. So for this transformation, I am ...
0
votes
1answer
169 views

Suggestions for html tag info required for jQuery Plugin

I have written a tiny bit of jQuery which simply selects all the Select form elements on the page and sets the selected property to the correct value. Previously I had to write code to generate the ...
0
votes
1answer
161 views

If I define a property to prototype appears in the constructor of object, why?

I took the example from this question modified a bit: What is the point of the prototype method? function employee(name,jobtitle,born) { this.name=name; this.jobtitle=jobtitle; this.born=born; this....
0
votes
1answer
169 views

Handling and organizing data from save file?

I'm working on a webapp (python/javascript) to modify a game's save file. The file has certain bytes representing player information, such as the gun, the equipment, etc. The idea is to show an ...
0
votes
1answer
518 views

What is Script Binding, and How is it done?

I have heard such thing as Script Binding - binding Javascript or lua with API's from C++ or Objective-C. I want to know more about it- however Google has strangely proven unuseful for this. How is ...
0
votes
1answer
187 views

What are known approaches to graphing algebraic expressions?

I am planning to build an expression parser that will be used to graph algebraic functions ( think TI-83 ) with JavaScript. Functions will take the form of f(x)= Aside from typical operators such ...
0
votes
1answer
94 views

Do CDNs (such as MSFT and Google) act on the referrer header sent by clients?

Will my site be automatically indexed, or search ranking affected based on my use (or non use) of the Google/MSFT CDN? My clients will be sending them the referrer header which I may or may not want ...
0
votes
1answer
242 views

reverse engineering js/html controls as part of development

I'm starting a project with a big client that has several websites across the world, and they want to integrate them into a single Sitecore codebase/structure. All good in principle, but there are ...
0
votes
0answers
33 views

Managing adjacent components

(originally asked here, but aparently not the right place) I managed to create a minimalistic example to reproduce the confusion I'm facing, here's a working SandBox. I have a page ( see the Profile ...
0
votes
0answers
46 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
49 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){ ...
0
votes
0answers
25 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 ...
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
0answers
17 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
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
0answers
27 views

Service worker / caching a whole API in a Flask app?

I'm building a small scale app based on the Flask micro framework. In it, I have a service worker that caches the basic shell of my app (HTML, CSS and JS). However, I have dynamic content that is ...
0
votes
1answer
123 views

How to avoid code duplication caused by javascript dict access?

I have two functions that group a list of dicts according to the value of a certain key. Here's how my array looks: const sections = [ { file_id: '1', heading_level: 4, readme_file_name:...
0
votes
1answer
64 views

Potential Solutions to loading Javascript classes unknown at run time

I'm looking for some advice or potential options for loading javascript files in real time long after the DOM has fully loaded. Those javascript files need to be sent over a WebSocket connection, and ...
0
votes
1answer
102 views

How to design a system that can operate and replay its functions call stack?

I am writing a processor for the Citation Style Language (CSL) in JavaScript. Before I explain what my problem is, I must give some context first: CSL is an XML specification for describing how to ...
0
votes
0answers
76 views

Handling user permissions in front-end

I'm building an API that will be used by the front-end in React and I'm not quite sure how I should send the permissions of each user based on their roles. Some fields can only be edited in some ...
0
votes
0answers
67 views

Should modules strive to export only one thing?

Ideally, functions should do one thing well, and only one thing. Does the same thing apply to what a module should export? Of course, modules aren't always the same thing as functions, but they often ...
0
votes
0answers
145 views

Why does Babel convert async/await to generator functions rather than promises?

It's a bit of a moot point now that async/await is supported by all major, modern JavaScript engines, but I've always wondered why Babel converts async functions to generator functions rather than to ...
0
votes
0answers
30 views

Why does Vue.js rename / move all the internal data elements?

I'm following the code from Vue.js in Action, Chapter 3. (much deleted for brevity...) var webstore = new Vue({ el: '#app', data: { sitename: "Vue.js Pet Depot", showProduct: true, ...
0
votes
1answer
72 views

How to organize work with a few projects with shared codebase?

We develop two projects (and more in future) with JS, Vue.js, using npm, and we store each project in its own git-repository. We want to place common components (buttons, page-parts and page ...
0
votes
1answer
95 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 ...
0
votes
0answers
54 views

Messaging engine architecture with front-end and ORM layer (spring)

I'm looking to push my first QuickFixJ messaging engine into production, and I would like to know the best way to do so. Bear with me. The gist of the responsibilities is as follows: Through ...
0
votes
0answers
33 views

Extending prototype

I am currently refactoring a project where I come across the following kind of code multiple times: propertyFunction: function (feature) { doSomethingOnyWithFeature(feature); ... } Methods, that ...
0
votes
0answers
60 views

Two Web clients and Java server (HTTP and Websockets)

I have 3 software components of a Web Application: 1. JS-client application 1 (JSApp1) 2. Java Spring (REST and Websockets) server app (SRV) 3. JS-client application 2 (JSApp2) My current task is to ...
0
votes
0answers
23 views

How can I manage the state of my application using a dedicated object instead of what React offers?

Most of the react application I've seen are organized with components that, in my opinion, do too much. They may follow this pattern: class MyComponent extends Component { constructor() { ...
0
votes
1answer
70 views

Uploading file to the server for download

I've my front end written using HTML/CSS/Javascript. Front end is communicating with the backend(Oracle database) using Java Webservices (Spring boot app). Situation #1: User clicks on the Download ...
0
votes
1answer
66 views

Load files depending on browser or write workarounds within the file?

I'm writing up this website running under IIS with .NET Core. I developed most of the site with minimal use of JS so that the server will be doing most of the work (and thankfully so because of the ...
0
votes
1answer
64 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. ...
0
votes
0answers
31 views

Promise, Ecmascript and Whatwg event loop

I've recently learned that setTimeout is not part of Ecma 262 standard but takes part of WhatWG one. I have one misunderstanding concerning these two standards and I can't get how they converge. For ...
0
votes
2answers
97 views

Check or not objects in a Javascript API?

I'm writing an API in JavaScript, and I'm confused whether or not I should check if the API user is passing me the correct type on which the API expects to work. Actually not the type, but if you are ...
0
votes
0answers
136 views

Is giving sub reducers access to the full state a bad idea?

I've got a Redux app with a fairly flat state tree. All sub reducers handle one separate part of the state, and they are tied together with combineReducers. My problem is that in a few cases I need ...
0
votes
0answers
46 views

JS ecosystem - In which oder I should learn them?

I'm migrating from Java to JS and I would like to know what is the best way to do it in the field of JS ecosystem. After reading all the You Don't Know JS series by Kyle Simpson, I would like to ...
0
votes
0answers
55 views

Adding new parameter to Javascript function

What do I pass in for the existing arguments that have no value, undefined or null? Existing function foo(a, b) is called like foo(1) and foo(23, "hi"). After adding a new parameter, it's foo(a, b, ...
0
votes
1answer
281 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: { ...
0
votes
1answer
168 views

Why the methods of the Object Constructor do not work on DOM Elements

//------------ let person = { name: 'John Doe', age: 22 } let e = document.getElementById('task-title'); /* Object.getOwnPropertyNames() Returns an array containing the names of all of the ...
0
votes
1answer
82 views

Ext JS: Designing a base class and override it

I'm trying to define a base class and override it's items on different inherited sub-classes. I'm following MVVM pattern to fetch records from backend. Created several stores and formulas within ...
0
votes
1answer
142 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 ...
0
votes
0answers
250 views

Front-end-side encryption: Where to store password throughout session?

currently we're working on a small application where we store a bunch of JSON data coming from a JS-based graphing editor (think of a spiced-up version of this) in a Rails-based backend. We want to ...
0
votes
0answers
420 views

What is the cleanest way to model my domain in JavaScript?

I am building an SPA. It will use WebGL, Canvas and SVG for certain components, and html for rendering views. I have a messaging system setup to define messages coming from a server, which will get ...
0
votes
1answer
81 views

WebApp Design: Better way of updating information in a DOM element

Background: I was working on a personal project to create an Task Checklist Web App. I worked on the code with vanilla golang and javascript. It is a very simple app with limited capability. I've used ...
0
votes
1answer
1k views

Better alternative to having a html form with select input on every row in table

I have a web application (laravel) with a page which presents a large number of rows (financial transactions) in a HTML table. On each row I want to have a drop-down (select input) allowing the user ...
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 ...