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
3
votes
1answer
38 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 ...
3
votes
1answer
70 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 ...
2
votes
2answers
96 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 ...
3
votes
1answer
57 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. ...
3
votes
1answer
128 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 ...
0
votes
0answers
75 views

Trying to replace ManagementEventWatcher class in System.Management to switch to newer Microsoft.Management.Infrastructure

I am working on replacing a dependency in a library for System.Management and migrating to using Microsoft.Management.Infrastructure as recommended by Microsoft. The issue is that Microsoft.Management....
7
votes
0answers
126 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 ...
8
votes
2answers
246 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. ...
1
vote
0answers
48 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'...
7
votes
2answers
294 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. ...
2
votes
1answer
109 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/@...
2
votes
1answer
37 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 ...
3
votes
1answer
56 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 ...
1
vote
2answers
68 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 ...
3
votes
2answers
202 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 ...
1
vote
0answers
23 views

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

I has div block feedList which contains feedItems. Now to fill ...
0
votes
1answer
412 views

C# Event handler for WPF MVVM

So I've been learning about MVVM and I had a problem. I often had to start a thread to download or do some longer task in background and when it is done change some properties so the UI updates. The ...
1
vote
0answers
40 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
35 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
28 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
2answers
201 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
51 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
211 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
39 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
431 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 ...
3
votes
1answer
50 views

eCommerce Mock App

This is a follow-up question to eCommerce Mockup App in JS. How do I implement the 'observe' pattern for the cart to regenerate html? So that, it will keep refresh its own. And any review on my coding ...
3
votes
1answer
51 views

Basic event stopPropagation() example - a better way of doing so?

I've got a very very basic demo here that uses the .stopPropagation method. I want to just make it so that clicking on the parent element only runs the function, so ...
5
votes
2answers
284 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
0answers
451 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
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 ...
6
votes
3answers
426 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
84 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
136 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
209 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
137 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
94 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
52 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 ...
10
votes
0answers
124 views

Resizable containers with VueJS

Some time ago 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
39 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 ...
7
votes
3answers
3k 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
133 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
183 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 ...
10
votes
2answers
104 views

User-focused timeline logging

I'm working on a small piece of my personal website. I'd like a timeline logging all of my relevant achievements in my career in Computer Science, in general. I'd like to implement a feature that ...
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
381 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
2answers
1k 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
82 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
380 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
208 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
198 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
2 3 4 5
9