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.
1
vote
0answers
23 views
Event Service in c++
I'm interested in receiving some feedback regarding an Event system that I wrote. Both in style and implementation, but also in overall design and the design decisions that I made.
It is intended to ...
3
votes
1answer
53 views
Event delegation without jQuery
I created event delegation like concept which is present in jQuery. AFAIK, event delegation is used to register an event for an element which is supposed to be added dynamically. So, in jQuery we do ...
0
votes
1answer
48 views
PageVisibility API, to handle page/tab visibility changes
Currently, I'm working on a project where I needed to run some code everytime the page is hidden.
I searched high and low and found this question: Is there a way to detect if a browser window is not ...
0
votes
0answers
20 views
Event Delegates using IIFE or Module
I am learning jQuery/JavaScript best practices and am attempting to put them into practice. My overall goal is to have lots of small, independent .js files which contain specific functionality and ...
5
votes
2answers
205 views
Yet another event dispatcher in c++11
I've written an event dispatcher for a private project which task is to collect events from different threads and dispatch them in a single thread:
...
1
vote
1answer
80 views
C++11 event system
I've implemented an events system in C++11. I've now got it pretty much as good as I can get it. It feels like I have found an optimal design pattern, and I'm using sensible variable names to ...
0
votes
2answers
36 views
Keyboard handler for moving in four directions
I'm having trouble deciding if I should leave the default: break; in the switch statement or not. It does kinda show intent, i.e. that most keys are not handled, ...
1
vote
2answers
62 views
Keyboard handler to move a shape in response to arrow keys
I finished Codeacademy and I'm looking to practice and get better at JavaScript. Is this coded correctly or should I have made a function for it somehow? The purpose of this code is to move a square ...
2
votes
2answers
63 views
Keyboard handler for selecting radio buttons
I have got my JavaScript working as seen here:
https://jsfiddle.net/yLg1qs04/3/
But how do I condense/shorten it so that it's not repeating itself so often and taking up so many lines?
...
5
votes
2answers
204 views
Type-Safe Event System
I have recently started writing C# from a strong JavaScript background, and found myself wanting to do something I do all the time in JavaScript: events.
Since I have a type system at my disposal, I ...
5
votes
1answer
73 views
3
votes
2answers
73 views
Raise an event (sample 1)
I'm writing tutorials for new programmers. The tutorials show programmers how to structure events.
I've attached the code for one of the tutorials. Can someone take a look at my code and let me know ...
6
votes
1answer
180 views
C++14 Event System
I've created a simplified event system for C++14. The code is commented, so it shouldn't be hard to read. There's also a simple usage scenario below.
It is still a work in progress and uses some ...
3
votes
2answers
86 views
Removing all delegates from an event dispatcher
Given a class which is an event dispatcher whose underlying store is a dictionary of events whose key is the event type ...
0
votes
0answers
24 views
A cross browser and backwards compatable solution to the PointerEvent, MouseEvent, & TouchEvent
I came up with this solution and I'm very happy with how it turned out. However, I would love some feedback from experienced developers as to its efficiency. I am working heavily with touch and mouse ...
2
votes
0answers
43 views
Alternative to clicklistener inside an anonymous class
For a trivial word game, I wrote the following code for the player to choose one of the two choices of words that in turn were read from a sentence.
My question lies in first in the click-listener of ...
5
votes
2answers
81 views
Toggling dropdowns using jQuery, with binding and unbinding
This code is used to toggle some dropdowns. I've added the click event on the document to close the dropdown on click outside, but I'm not sure if I'm doing it the right way. I want it to be optimized ...
3
votes
0answers
28 views
Periodically monitor if record is not updated using Node, Event and setTimeOut
Here is my scenario:
Every user checks in every five minutes.
If some user doesn't check in after 5 minutes, I should be able to keep track of it.
If some user doesn't check in N number of times, an ...
4
votes
1answer
31 views
Three identical AJAX button handlers in three views
In my Rails 4 app I have this event listener:
...
3
votes
2answers
166 views
Handling events in a multi threaded environment
I have a service that raises multiple events, some of them can be raised at the same time. I need to process those events and run a potentially long running method based on the event arguments.
What I ...
0
votes
1answer
55 views
Form validation using IIFE and closure [closed]
Problem statement
Write an IIFE in which we have to validate the input provided from a form using closures. The form consists of name, email, phone, address in which name, email and phone ...
4
votes
3answers
50 views
Track mouse coordinates
Problem Statement
Write a JavaScript program that prints the mouse coordinates in a text area when the mouse cursor is moved over the HTML document.
Expected Output
Solution
...
7
votes
3answers
112 views
Downloading files from a Mozilla file server via FTP
All classes on GitHub repo
This is the code for downloading files from a FTP-server running Mozilla Fileserver.
FtpItem is the interface for the two classes ...
4
votes
2answers
56 views
C++ EventHandler class, invoking & arguments
This is my EventHandler class, which is extremely simple and can be used on lambdas and similar:
...
5
votes
3answers
104 views
Detect how long an HTML button is pressed
I recently had the need to detect how long a button is pressed and perform different actions based on that. I found some examples on Stack Overflow, but the ones I looked at showed how to use ...
2
votes
1answer
32 views
Handler for bidirectional unit conversion form
Building a form where values can be entered in either pounds or kilos.
Script is...
...
3
votes
1answer
95 views
Animating sprite without libraries
I'm building a small game in pure JS for my own learning purposes, using sprites to model players.
Before I go further, I want to try to get the animation down. The below code should produce a blank ...
2
votes
2answers
88 views
Xml messages processing networkstream [closed]
I'm currently processing xml messages with C#. It is working But I'm not confident that my code is fast enough. There are 3 possible messages I can receive. When I receive one the message an event is ...
2
votes
2answers
82 views
Using actionPerformed() to call different methods per radio button selection
My Java is very rusty and I have been unlucky finding a better way to accomplish this task. I have two different methods which get called based on which radio button is selected. Is there a cleaner ...
4
votes
2answers
85 views
Pub/Sub in JavaScript
This seems to work, but for some reason I'm not entirely sure about it.
Can anyone point out any issues with this simple pub/sub library?
Thank you!
...
5
votes
0answers
140 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 ...
4
votes
2answers
100 views
Designing a Backspace key
I have designed a Backspace button (part of a keyboard which I am designing) in windows forms and it works perfect with no errors (the code works very good). This button deletes what is inside the ...
3
votes
2answers
76 views
Custom event handler in Javascript
In my web projects I often need a simple way to trigger callbacks defined somewhere else. Leaving jQuery finally behind me, I was missing their simple event system and tried to create my own. I'd like ...
2
votes
0answers
199 views
C++ 14 event bus implementation
The code allows you to subscribe to events and publish events via an EventBus class. Events are identified by a source and subject. Events can have a single ...
6
votes
1answer
166 views
Event dispatcher / listener
I'm working on a program that will be significantly multi-threaded. I need to respond to events between objects and threads so I've come up with the following code.
...
6
votes
2answers
214 views
1
vote
1answer
50 views
Javascript event handling via switch
The application I am developing with has many input fields that interact with one another via the onchange event.
When developing started, the goal was to create a framework that makes it easy to ...
4
votes
1answer
98 views
C++ EventHandler Class
I need to have some thread-safe event handler (like C#'s EventHandler), so I made one. Here is my event handler class and sample code (compiled with VS2013). Is ...
6
votes
1answer
116 views
Custom Event System in C#
I'm currently writing a game and want to encode everything that happens (GameObject has moved, hp changed, was created/destroyed, got/lost a component, ...) in Events that look like this:
...
4
votes
1answer
101 views
Angular wrapper for SignalR event aggregator
I created a little wrapper for one of my JavaScript libraries to enable Angular functionality. Are there any pitfalls I should be wary of with my code?
...
1
vote
4answers
105 views
Update extremities losses when selected type changes
The following code works, but is it a good idea to call another method in a setter?
...
6
votes
1answer
80 views
GitHub (and Bitbucket) Pushing Events
This code is for dispatching and handling certain events from GitHub (and also Bitbucket). Things like pushes, issues, etc. can be handled by this system, and strongly-typed objects will be returned.
...
2
votes
1answer
143 views
Simple event emitter
I have written a simple event emitter in Python, which allows subscribing to events and emitting events (along with monitoring events too). I'm rather new to Python, and would like some feedback on ...
4
votes
1answer
37 views
Style-changing handler for an HTML drop-down box
How can I maybe do some loop that will compress the amount of JavaScript/jQuery I need to use. I have a function s3episodesChange() linked to a ...
3
votes
1answer
186 views
Event Aggregator Pattern Decoupling
I have an Android application that is using an EventBus architecture with publishing and subscribing events. Usually this is ...
7
votes
2answers
121 views
Drag and drop single files on different targets for different purposes
I have three text fields (DevExpress ButtonEdits set to read only) on a Windows Forms app. They look like this:
They're used by dragging and dropping a single ...
3
votes
1answer
421 views
Event-listener implementation
While writing a C++ GUI application more or less from scratch I needed some form of an event-listener system, preferably using lambdas. An event should be able to have multiple listeners and the user ...
-1
votes
2answers
75 views
Toggling class on mouse hover
I am using this code to add a class on mouse hover to a link button and remove it on mouse leave.
...
2
votes
1answer
96 views
Keyboard input class
I am looking for advice on my input component. There is no real problem with it yet, but I am just getting started on everything and want to know if there is any obvious problems with it, plus I was ...
7
votes
1answer
72 views
Detecting two keys pressed in quick succession
My computer has been having this issue where when I press a key, two key presses get registered. The goal of this program is to detect the time delta between the two keys so that I can set an ...