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
6
votes
1answer
144 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 ...
11
votes
0answers
414 views

Windows keylogger in C++

Windows keylogger in C++ Known issues: Not implementing rule of five Having to use hack to use member variables, out_, in static method Pressing caps-lock won't ...
1
vote
0answers
21 views

How to refactor below nodejs code to unblock event-loop?

I produced below code and soon it became outdated due to the blocking nature of it's loops which I can't see how to avoid that. Work-flow summery Client send a request to "/" to get a list of JS ...
0
votes
1answer
27 views

Cleaning up Javascript event listener that manages game-loop

As I added more features to my chess game, such as an endgame screen. I eventually ended up having a lot of duplicate code, and complex logic with lots of nested if statements in loops. The usual ...
1
vote
0answers
22 views

AIPlaylist: Adaptive media player using VLCJ and Swing

I created a project using VLCJ and a probability function to create a media player that plays your favorite media more often than the others, because I wanted to hear my favorite music and videos more ...
2
votes
1answer
11k views

onChange vs onKeyPress for input in React

I have an input form, and when you press enter I want it to call a function. I was wondering what "the right" way of doing this is. Right now I have an input looking like this: ...
1
vote
2answers
126 views

jQuery form.find radio class

In my application we have four inputs radio controls and on the load the value is checked to true. When the user select another radio and then save the form I want to get the new value. I am using the ...
-2
votes
1answer
18 views

How to test that an event will not be fired in xUnit? [closed]

I have two questions. Does it make sense to test that an event will not be fired? If yes, what is the best way to accomplish that using the xUnit framework? For ...
3
votes
1answer
44 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 ...
9
votes
2answers
333 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
1answer
83 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
1answer
26 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
81 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
1answer
1k views

JavaScript quiz game

Here is the JavaScript code: ...
3
votes
1answer
69 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 ...
5
votes
2answers
272 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 ...
2
votes
1answer
57 views

Monitoring navigation function: logic judgment

Write a simple monitoring navigation function. I feel logic judgment still needs to be optimized. I don't have a clear idea right now about code logic such as reducing ...
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 ...
6
votes
1answer
146 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 ...
2
votes
0answers
118 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(-...
6
votes
3answers
197 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. ...
3
votes
1answer
53 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. ...
1
vote
1answer
75 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....
8
votes
1answer
336 views

Cat Clicker MVC

I'm training my coding and wish you guys to see how my code is. I made a cat clicker based on the MVC pattern. Basically it shows a list of cats and when you click a cat name it shows an image, and ...
2
votes
0answers
65 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
52 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 "...
4
votes
2answers
240 views

Zig-zag child element with Flexbox and JavaScript

Recently I found a question on StackOverflow that seemed very interesting: How to make HTML elements "zig zag" this way: ...
13
votes
2answers
820 views

Setting up radio button click ActionListeners

Instead of writing four almost identical setOnClickListener method calls, I opted to iterate over an array, but I'm wondering if this was the best way to do it. Do ...
5
votes
2answers
59 views

Sparking animation for Button

I just came through a GitHub repo, which has an amazing animation for Button in Android. So, I thought why not make that for web buttons too. And I started ...
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 ...
7
votes
2answers
107 views

Controlling Finances with Web Development

Purpose First, let me explain the title: I previously had managed my finances like an old fashioned company might, and it worked wonders for making financial decisions (at least for me). I wanted my ...
3
votes
0answers
61 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 ...
6
votes
1answer
66 views

Determine if a section is in view

i am currently learning to do things with vanilla Javascript. No plugins, libraries or code snippets. I want to do things on my own, so that I understand 100% of what is happening. I wrote a little ...
2
votes
2answers
6k views

Form for OTP entry with six single-character text fields

I am working on an app in which I have to pass 6 digits OTP through 6 textFields in which you to provide only one character and after that it automatically goes to ...
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 ...
6
votes
3answers
706 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 ...
9
votes
1answer
3k views

Implementing my own signal slot mechanism using C++11

I programmed in C# and I used the Qt framework. Both of them have their own signal slot mechanism which are really powerful. I looked at several implementations in C++ and based on what I learnt from ...
2
votes
2answers
161 views

Simple menu with descriptions

If one menu-item is clicked then the description with the same data-filter attribute should be shown. I added a class to the description elements to associate each one with the affiliated menu item. ...
6
votes
1answer
86 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, ...
2
votes
0answers
22 views

UI Event Flow class

Purpose: I wanted a way to improve event clarity and event code organization. I observed that every single event flow went through the following steps: Trigger -> UI Change -> (Async) ...
7
votes
1answer
121 views

First Javascript program - Snakes game on HTML canvas

I'm relatively new to programming but my most familiar languages are Java, C# and Haskell and this is my first javascript program. All the concepts used in here were just the first thing that came to ...
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 ...
3
votes
0answers
62 views

Javascript Call To Action Modal

I created a simple modal that when a user scrolls down a blog post, a modal pops up. If the user wants to sign up for newsletter, then a form pops up. The only external library I used was body-scroll-...
7
votes
2answers
181 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 ...
5
votes
3answers
347 views

Wrap a js function with a fixed this arg

If I use node.addEventListener('click',Wyg.Editor.nodeClickedEvent); then when node is clicked, ...
5
votes
2answers
72 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
365 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....
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
67 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 ...
3
votes
2answers
124 views

Calculate the heat flow (for radiators)

I´m a programing rookie with minor javascript skills. So I ask you for a code review since I'm not sure whether my code is ok. Short explanation of my program: I work for the heating industry. ...

1
2 3 4 5
9