Questions tagged [event-handling]

Event handling is a coding pattern related to acting on messages between a source and one or more subscribers. A point listener in the source provides a way in which subscribed code can consume messages raised from the source.

Filter by
Sorted by
Tagged with
1
vote
0answers
6 views

Summing CSV files row by row using Node.js events

I need to read multiple CSV files that have the same number of rows, and compute some results for each row. For simplification purposes, and in the scope of this code review, this computation would be ...
1
vote
1answer
22 views

Showing form on btn click - preventDefault of submit btn, then remove listener

I've built out a section on a page that contains multiple instances (why I'm using querySelectorAll()) of this Request Brochure form. They are using Campaign ...
2
votes
2answers
43 views

Publisher Subscriber Pattern Template

This is the first time that I have tried programming in such a general way using c++. I have tackled this pattern before in other languages such as ...
5
votes
2answers
261 views

Message Broadcaster

I've written a basic event messenger broadcasting service. This is meant to allow for broadcasting events between loosely coupled areas of code where you may not have or care about a direct reference ...
0
votes
0answers
9 views

How can I properly handle backend service events in SignalR?

I have some doubts with the following code that implements a SignalR endpoint that receives and sends messages. Basically the ISendValuesService produces new ...
2
votes
0answers
71 views

Simple event broker / eventbus in C# (~100 lines of code)

Background I was looking for a simple Event Broker or EventBus (whatever else keyword you can come up with) to use in a small(-...
3
votes
1answer
68 views

High-Level Managed Observers

I was thinking of adding a very high-level implementation of the event/observer pattern to my project. The implementation would manage adding and removing observers as "needed". You can use an almost ...
6
votes
3answers
159 views

C# Event Manager without allocations

I'm using my own Action-based Event Manager for a while and looking for ways to improve it. Mainly it's used in game development, where excessive garbage generation can lead to severe consequences. ...
1
vote
1answer
67 views

Creating a simple event system

I am trying to make a very simple event system for learning purposes, after seeing some much more complicated code on the internet I was wondering if what I am doing is fine of if it has major issues....
3
votes
1answer
51 views

Javascript Slider that controls TinySlider - feels inefficient [closed]

I feel like the main point of inefficiency is how I create "notches" and must loop through all of the created notches every time the value for the slider is changed. ...
2
votes
0answers
54 views

JavaScript: implement event listener in custom object

For many years, there have been several JavaScript libraries for implementing custom events and event listeners. But, as MDN web docs suggests, there are now available constructable Event, CustomEvent ...
1
vote
1answer
46 views

Clean up function in Javascript Event Listener

I am trying to refactor a chess game I am currently creating so the code is more flexible and maintainable, while doing this, I came across an event listener which I have no idea on how to make "...
5
votes
1answer
82 views

Javascript To Do Application

I've created a simple JS 'To Do List' application. I'm very new to JS and this is the first JS project I have done. I would greatly appreciate any feedback on how to make the code more efficient, ...
1
vote
0answers
51 views

Repetitive code for an event listener

So I'm using the event emitter as some sort of an event bus(If I'm allowed to call it that). The problem I've stumbled upon is that my listeners might want different data than another listener. Since ...
3
votes
0answers
55 views

Resizable containers with VueJS

I reviewed the code in Resizable split DIVs Vue.js, suggesting that the OP use computed properties and bound styles to simplify the code (at least reducing the need to use ...
1
vote
1answer
38 views

Display name and email fetched using JSON API when hovering

I'm learning AJAX JSON. I'm just testing how to pull the data. The idea is, when hovering over the number, it pulls the data and show the content for name and email. Number 1 is to show name and ...
4
votes
3answers
367 views

Event loop in C++

Writing an EventLoop in C++. Few requirements, from a user perspective: Must be simple to use (as simple as the Javascript event loop) No type casting, no complex registering of event handler. Plain ...
6
votes
1answer
78 views

Light weight C++ Signals/Slots or Event System

This assumes there is no need to aggregate results from the listeners of a broadcast signal. Technically I guess the slots are whatever your std::function holds, ...
6
votes
1answer
129 views

Resizable split DIVs Vue.js

I just started Developing Web App (Vue.js) for my company for around 1-2 months. Therefore, my knowledge and experience in HTML, CSS and Javascript is kinda shallow. I've created a custom resizable ...
4
votes
1answer
80 views

More Efficient Way To Search On-Demand

I need better logic that would allow this search to perform quicker and more efficiently. In XAML, I have a DataGrid and a ...
5
votes
3answers
342 views

Wrap a js function with a fixed this arg

If I use node.addEventListener('click',Wyg.Editor.nodeClickedEvent); then when node is clicked, ...
9
votes
1answer
270 views

“Block a website” script with vanilla JavaScript

I use this script to block access to a one or more websites with vanilla JavaScript. I find that it helps me avoid some addictive news websites that make me depressed. (Credit to Marat Tanalin for ...
5
votes
2answers
70 views

Dropdown menu that opens on click using plain Javascript

I made a simple dropdown menu which opens when clicked, and closes when the user clicks anywhere outside the menu. The following is the codebase: ...
4
votes
3answers
363 views

Process queued data in the background

Currently I'm writing something like a messaging or logging framework (I'm not really sure how you name something like that). There are different servers which have to be notified if something happens....
7
votes
2answers
175 views

eCommerce Mockup App in JS

I have completed this mockup eCommerce app using Javascript. This version can add products into a shopping cart and automatically calculate the order summary in the shopping cart. It can also delete ...
6
votes
1answer
124 views

Simple input class change with vanilla JS

I am just testing how I solved simple stuff. Goal: The aim is to expand the width of an input and collapse it. When mouseover ...
1
vote
1answer
57 views

Automatically select the table rows between two selected rows

The code is to check the rows in a table. If in a table two non consecutive rows are checked then all the in between rows should be selected by itself. Also, after selecting two rows, on selection of ...
2
votes
2answers
64 views

Cardinal direction enum from range input

Still learning JS and I made the following function to convert degrees into cardinal directions respectively. My first iteration of the code was over 50 lines and I was able to get it down to 13 using ...
4
votes
2answers
113 views

Dynamically add/remove fields on input

The following code allows users to enter multiple optional quantity fields after first filling in a value of the current quantity input. If the input field contains a value it will then display the ...
4
votes
1answer
78 views

Event triggers for animations using vanilla ES6

I'm new to JS and wanna know right code style or approach to cod Vanilla JS using ES6. To practice this, I'm using ESLint JS code-style of AirBnb and referencing clean-code-javascript repo. However, I ...
4
votes
1answer
57 views

Responsive, scrollable sidenav for old browsers

The following code has been tested on the latest chromium, on Opera Mini, on Safari for IOS 7 and finally, on the default web browser on android 2.3.3. As you may already know, the CSS ...
3
votes
1answer
63 views

Simplified board for X's and O's using Tkinter

Recently I am learning to program in Python and in order to practice I tried to program a little game which consists in a board with 9 cells. In this board each player draw an 'X' or 'O' with left or ...
2
votes
0answers
64 views

Await data coming from an event [closed]

This is a USB related question, but the problem is not USB specific. When reading data from a USB endpoint, there are two patterns I am concerned with. Request/Response like HTTP (done over the Bulk ...
8
votes
2answers
97 views

Vanilla Javascript: Chained AJAX request

I'd be grateful for a review of my AJAX request. If I have taken the correct approach here and especially any security concerns! I am creating a Purchase Order system for my manager (as part of an ...
13
votes
2answers
269 views

Emulation of SE's text input control for tags

Introduction I used React to write a component, which is meant to be a faithful emulation of the input for "Tags" which you see at the top of every question/topic on SE. Why this project? If you're ...
1
vote
0answers
18 views

Creating a reusable plugin (Dialog/Notifier as example)

I started working on a notification system that is pluggable into any project. I have not made any "plugin" type javascript libraries, usually just functions very specific to the project at hand. That ...
2
votes
0answers
350 views

Angular 8: Scroll spy implementation for a timeline Contents

I have made a timeline component that can have multiple milestone/major/minor as sub components nested within timeline container component. I have also added a side navigation for that lists all ...
5
votes
2answers
281 views

Crystals Collector game with four clickable buttons

I'm a few weeks into javascript and had to make a simple "crystals collector" app. The app works as intended, but the code is obtuse and repetitive. I'd like to make the app work using just one on ...
2
votes
1answer
66 views

Toggling a class in JS

I'm toggling the class of an element with this code but I'm pretty sure it can be written more efficiently. ...
2
votes
0answers
590 views

Event management system in C++

I have this question asked as home assignment for an interview. I submitted my solution and did not get selected. Wanted to know your feedback for the solution. Question: Write a very simple ...
4
votes
1answer
87 views

How to group custom events [closed]

I have a number of custom events that a class might or might not subscribe to. ...
2
votes
1answer
51 views

Is this a proper way to cancel an onMouseOver which uses setTimeout? (Vanilla JS)

I've got a working solution for an onMouseOver event which rolls over a set of images and replaces them in the element. Due to my lack of knowledge in JS I would ...
3
votes
1answer
66 views

Whitelist for textarea and save input to file

I'm working with product codes, so a user can only scan these type of product codes into a textarea. I don't know if my code is written the best way possible, or has good performance. I'm using a ...
3
votes
2answers
232 views

jQuery dynamic toggle class function

I wrote this function that will toggle a class of a targeted element. Applying the class js_class_toggle to any element will trigger the function when clicking on ...
8
votes
4answers
520 views

Making an Action<T> event also usable as Action<object> and Action in C#

Edit I've added a second pass at this problem based on the answers that have been posted by other users so far: https://codereview.stackexchange.com/a/221525/75659 Context Before presenting the ...
7
votes
1answer
494 views

Simple integration of async and tkinter in Python

I've been a fan of coroutines and asynchronous programming for a while, and I recently took a trip down memory lane to when I was using Python's tkinter module for ...
1
vote
0answers
24 views

Dragging and dropping a spot using TypeScript

Currently my code is based around mouse events so that it is easier to test but I will be swapping these to touch events once I have had the code reviewed. The idea of the UX is that you need to ...
3
votes
1answer
397 views

Implicit Async and none async event handlers

I have implemented a event aggregator for our backend. ...
6
votes
2answers
370 views

Tic-Tac-Toe code in JavaScript

I have developed a tic-tac-toe game in native JavaScript. Can you tell me how to optimize more and what are the missing things? JSBIN The logic, modular approach, testable and scalable? ...
4
votes
1answer
89 views

<select multiple> with dropdown

I wanted to use <select multiple> but was annoyed by the poor design on desktops which is why I created a version with dropdown: ...

1
2 3 4 5
9