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
1 answer
203 views

Event manager for games written in C++17

This is a single header event manager that I'm using in my game. Disclaimer I ripped everything from these lovely people: https://austinmorlan.com/posts/entity_component_system/ C++ Event System - ...
Burning Flemingo's user avatar
6 votes
3 answers
2k views

EventBus in C++

Edit I do know the example key event doesn't carry any data (like keycode) but that isn't really the point of the review - the overall setup is :) Original After reading quite few suggestions on this ...
Jiri Kralovec's user avatar
1 vote
0 answers
21 views

Event system in react

What I Want? I want to make an event system in React that cuts back on unnecessary re-renders and stops props drilling. What I Did? The code I came up with is the following: ...
workoverflow's user avatar
3 votes
3 answers
130 views

Follow up: A chat server using the select() API

This is a follow up to my last question: Multiperson chat server using the select() API Changes: After much fine critique, I made the following changes to the code: Removed redundant casts and ...
Haris's user avatar
  • 1,131
7 votes
2 answers
741 views

Event functionality in C

I am beginner to intermediate and wanted to write a little event code in c. It's one header file with 108 line pure code and it does what I was thinking it should be like for me. EventListener.h ...
mortytheshorty's user avatar
0 votes
1 answer
58 views

Delayed, concurrent event stack in Java - follow-up

I have slightly refactored the Delayed, concurrent event stack in Java. Now it looks like this: DelayedEventStack.java ...
coderodde's user avatar
  • 26.7k
0 votes
3 answers
191 views

Delayed, concurrent event stack in Java

(See the next iteration: Delayed, concurrent event stack in Java - follow-up ) Motivation I was confronted with a task of having "message events" for a GUI program. The use case is as ...
coderodde's user avatar
  • 26.7k
3 votes
1 answer
447 views

Count how many times left mouse button is clicked

The code snippet works perfectly fine, but someone said, and I quote, "this is some of the weirdest code i've seen", so I'd just like any advice for it. It's supposed to count the amount of ...
shge's user avatar
  • 33
1 vote
1 answer
37 views

Moveable Points - Update variable without Re-referencing variable? Event Subscriptions? (C#, Unity)

So I have this helper script that I use to move points around manually while debugging: ...
FaffyWaffles's user avatar
2 votes
0 answers
62 views

To-do list application

I use a lot of for loops and I think it slows the code down a lot but I have no idea how else this code could be written. Its for a to-do list app and each ...
Helan's user avatar
  • 21
0 votes
1 answer
50 views

JS "Tabs" element

How can this be improved? I'm looking particularly at the twice repeated tabButtons.forEach(button => { ...
Matt's user avatar
  • 1
4 votes
1 answer
234 views

Setting all hidden fields based on id

I am working on a web page where there is a checkbox with a value and a hidden field. I want to ask your opinion on whether this logic is sound. My logic The checkbox has a value that matches the id ...
Jefferson's user avatar
  • 445
0 votes
0 answers
402 views

Filter duplicate events raised by FileSystemWatcher

As you know about FileSystemWatcher Events, which may fired twice or more according to OS handling, For example creating a .txt file may fires two events (1)For ...
msh's user avatar
  • 1
2 votes
1 answer
357 views

Animating GIF on hover in Javascript

I don't know JavaScript and it's safe to say this is my first code ever written in JS. I just needed to animate my GIFs when user hovers over them only. Googling separate concepts such as "string ...
Edenia's user avatar
  • 1,538
1 vote
1 answer
51 views

Event handler for client webrtc video chat

This is my event handler for a videochat client that takes all the events that the server throws at us and routes them to different functions. All of the functions are imported and both settings and ...
PWall's user avatar
  • 11
0 votes
1 answer
84 views

Range slider show/hides and reset (vanilla js)

I have a HTML5 range slider. i.e. ...
Coastal-Cam's user avatar
1 vote
1 answer
226 views

Basic Event manager implementation

I have written a very simple algorithm vizualizer where all input is coming from the mouse and I needed an event manager for that. Since I never wrote one before, I wrote a 30 min implementation to ...
a a's user avatar
  • 157
0 votes
0 answers
36 views

A C WinAPI program for showing the color of the screen pixel pointed to by mouse cursor with clipboard support - follow up 2

Now it seems that I was able to make some progress with my program. See what I have: ...
coderodde's user avatar
  • 26.7k
1 vote
1 answer
131 views

A C WinAPI program for showing the color of the screen pixel pointed to by mouse cursor with clipboard support - follow up

(See the previous question.) Now I have incorporated some suggestions by Barmak Shemirani. See what I have: ...
coderodde's user avatar
  • 26.7k
4 votes
2 answers
251 views

A C WinAPI program for showing the color of the screen pixel pointed to by mouse cursor with clipboard support

(See the follow-up question.) I have this program that shows a small window and that window shows a rectangle whose color is the same as the color of the pixel under the mouse cursor. Note that it ...
coderodde's user avatar
  • 26.7k
0 votes
1 answer
212 views

Updating active cards dynamically added by API

I am making a website where you can search through all the countries in the world. Once you have found a country you want more detail about you should be able to click and view a detailed page with ...
Bram Mortier's user avatar
2 votes
2 answers
202 views

Event Dispatcher for GLFW/Glad

I've tried to write an event dispatcher for a GLFW/Glad library. However I am not very used to writing efficient code (spent the majority of my life writing in C# and performance was never really the ...
ScrappyHaxor's user avatar
3 votes
1 answer
237 views

Javascript array from IP address

I want to make this code better. It works now but I think it can be better. I have a working sample on jsfiddle. When the page loads I have the End IP Address disable until the data is entered. Then I ...
Jefferson's user avatar
3 votes
2 answers
646 views

Event Dispatching System

Below you can see my implementation of a simple event dispatcher. I would like to get some feedback or improvement tips regarding the design and maybe an idea how to get rid of the static_cast. Thank ...
Manu's user avatar
  • 133
2 votes
1 answer
693 views

Generic Event class

C++ Event class From the desire of having a callback function which includes a void* userdata argument, I've made this generic event class. It is tested and working, but some desired features are ...
Shigoto Shoujin's user avatar
1 vote
2 answers
112 views

Javascript - On mouseup check if any of the parents has/includes specific id

On my page I have a mouseup eventlistener on document. I want to be able catch if the clicked elements has a specific ...
Rubioli's user avatar
  • 113
1 vote
1 answer
133 views

list of games to open radar match in iframe on for drop-down controls

In general my page is slow and has several points in the code that I believe can be improved, even in relation to the structure used. Anyway, the biggest problem is: The page I'm creating is very ...
Digital Farmer's user avatar
3 votes
2 answers
95 views

Javascript (ES11) Event System implementation

So I decided to implement a basic event system in JavaScript. My goal was to support the following functions: on - allows the user to register a handler on the ...
Hex's user avatar
  • 425
3 votes
0 answers
191 views

A Compile-time templated event system and dispatch manager

Problem I would like to make an efficient, extensible, and potentially asynchronous parallelizable event system using modern features in C++20. My solution I've constructed a templated event struct by ...
Robbie's user avatar
  • 131
0 votes
2 answers
130 views

is this a good way of using events?

So I'm currently trying to learn more about events using C# and the example that I just write seems a bit.. It seems a bit too much? I feel like you could accomplish the same thing with way less code. ...
John V Dole's user avatar
3 votes
2 answers
75 views

Limit second <select> options based on the first <select>

I want to see if there's a better way to write this code, solely in Javascript. There are two kinds of sets, the first set (C7, T7, C11, T11) have four options in the first select, and then up to two ...
Liv Strawbridge's user avatar
2 votes
1 answer
307 views

To-do app front-end in Vue 3

I have put together a To-do Application with the Slim framework on the back-end (API) and a Vue 3 front-end. I added a demo on my YouTube channel. In the main App.vue file I have: ...
Razvan Zamfir's user avatar
4 votes
2 answers
823 views

Vue.js checkout stepper

I have made this small checkout stepper with Vue (v 2.x.x): ...
Razvan Zamfir's user avatar
1 vote
1 answer
259 views

dispatch event listener problem after click

My code is working fine... but I want to remove below those(1) lines of code from my example code(2) (JS Code). If I remove those code then a tag is not working. (a tag do not open link or href is not ...
نور's user avatar
  • 63
2 votes
1 answer
238 views

JavaScript copy-to-clipboard class

I am have made a small copy-to-clipboard script. I have made a method called copyToClipboard that does the following: create an input box; read the content of an ...
Razvan Zamfir's user avatar
4 votes
1 answer
85 views

Javascript Pub/Sub

Here is a short pice of code that suppose to work as Pub/Sub or EventDisptacher of some sort. I only do code in JS a few times a year, so hence I'm asking for your time. Right now I'm working on ...
Aksis's user avatar
  • 43
5 votes
1 answer
5k views

C++ event loop and thread signaling

Use case This is an event loop and signaling system I created for a piece of software which will have multiple asynchronous server/clients/event-emitters/ui, some of those components will have their ...
fededevi's user avatar
  • 300
3 votes
2 answers
6k views

C++: Event system for game engine

Since writing your own C++ game engine seems to be really popular these days (seriously just look at the amount of people presenting their WIPs on YouTube) I figured I'd try it myself. My mental model ...
TheBeautifulOrc's user avatar
3 votes
1 answer
189 views

Carousel Using Vanilla Javascript

As a beginner project, I've start working on this carousel slider that would slide through an image and a testimonial on click. The number of images and content slides would always be the same number. ...
Leandro's user avatar
  • 33
3 votes
1 answer
162 views

Submitting form jQuery checkboxlist

In my requestForm submit function I have this logic that checks three checkboxes and then displays the label with an error message. Is there better logic? I would be happy for any kind of feedback ...
Jefferson's user avatar
  • 123
8 votes
1 answer
992 views

C++ Event System - Game Engine

Introduction I have just started learning templates and experimenting with function pointers. I wanted to create an event system that met a couple of goals: Event types are PODs, and do not inherit ...
kainev's user avatar
  • 301
9 votes
2 answers
433 views

Flex panels in CSS and JS

I was following Wes Bos JS 30-day challenge, so HTML and CSS are mostly are copy-paste, I'd like feedback on JS (mostly). Thanks. ...
user3132457's user avatar
1 vote
0 answers
53 views

Basic Event Cancellation

I recently came across the need to allow consumers to prevent further execution of methods and I utilized an event driven system that allows the consumer to specify if the execution should cancel. I'...
Hazel へいぜる's user avatar
9 votes
2 answers
585 views

Animated Calendar using HTML + CSS + JS

I'm a beginner developer and I'm building a calendar for smartphones. I'm using HTML, CSS and JS. I'm not entirely done with the project yet, however, I have the feeling that I'm making a messy code. ...
LUCAS DE BIAZI FERREIRA's user avatar
2 votes
1 answer
333 views

Infinite Slider Conversion to Prototype

I've found the following example of an infinite slider to use on a project but as I will have multiple instances I have converted it to a prototype. The original example https://medium.com/@...
Bagseye's user avatar
  • 401
2 votes
1 answer
154 views

Multiple audio player - arrow keys & space

I am creating a VueJS component of an audio player. I am having some difficulties in finding the ideal way to get the arrow keys and space bar to work. I have found a solution, however I think it is ...
martinho's user avatar
  • 161
3 votes
1 answer
177 views

Creating a simple event message passing system in C# for a rudimentary 2d sprite game

I am currently experimenting a bit with C# and as a way of learning I am making a very simple 2D game (asteroids-ish). I am using the monogame framework and the general plan of attack was to have all ...
kiooikml's user avatar
  • 131
1 vote
2 answers
97 views

Javascript to-do application for native Javascript

I did a simple to-do application for native Javascript. This is my first time, previously I used only jQuery. What recommendations would be useful? https://codepen.io/denibudeyko/pen/MWyEmox ...
Dan's user avatar
  • 121
3 votes
2 answers
3k views

C# One type to represent multiple types (including generics)

Our monolithic WinForm application is getting a face lift. One current challenge that we are restructuring how we setup events. I rolled my own event manager class to handle the subscriptions and ...
Daniel's user avatar
  • 31
1 vote
0 answers
28 views

Dynamic adding and removing div elements using event streams (eventlistners)

I has div block feedList which contains feedItems. Now to fill ...
Gudsaf's user avatar
  • 186

1
2 3 4 5
10