Questions tagged [observer-pattern]

A software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods.

Filter by
Sorted by
Tagged with
3
votes
1answer
56 views

Logic is stored in Components that receive input data and update output data via Observables

I have C# ASP.Net Core Webapi application that makes some calculations for physical models. I have this project class: ...
3
votes
0answers
40 views

Implementing custom observable classes

I want to implement my own custom observable class so I can have a hierarchy of components and the closest defined configuration item bubbles to the front. ...
1
vote
0answers
10 views

RXJS and Ionic- Sequencial Subscriptions Waiting on User Action

In an Ionic App a user can open a new browser via "inAppBrowser". I'm trying to get the stats of the user before they go into to the inAppBrowser, get the stats again when browser closes, and then run ...
0
votes
1answer
119 views

How to observe multiple Observables? [closed]

About the Program It's a simple implementation of Observer Pattern. The choice of different NotifyMethod will affect how those observers are notified. The ...
2
votes
0answers
71 views

Scheduler built with observables v3 (follow-up) - now testable

This is a 2nd follow-up to my previous one about a Scheduler built with observables. Although the last one was working correctly, it was only possible to see this ...
1
vote
0answers
52 views

Applying Observer-Observable pattern to a code and multithreading

I have to: 1) Apply the Observer-Observable pattern to the original code. 2) starting from the original code, I have to suppose that the modification of the array fields (slot machine numbers) ...
2
votes
0answers
105 views

Observer(Event) system (Signals and Slots), type and template based

Signals are represented as types. You can connect a member function of some instance to the Observer system. This connected function will be called whenever a signal of a type that is the same type as ...
7
votes
1answer
162 views

Threadsafe oneshot-event which fires on subscription if the event was fired in the past

Assumptions Basically, a Connection class has a "Disconnect" event. Subscribing to this event isn't thread-safe, because the disconnection may fire from another thread right before I subscribe. So ...
0
votes
1answer
58 views

Apply stock quote changes using observer pattern

I am implementing observer pattern(refering codeproject) for stock quote update. I have created an interface for Subject and Observer. I have created instances for Subject and Observer and also the ...
2
votes
1answer
150 views

Implementing the observer pattern for a stock exchange scenario

I am trying to implement the observer pattern for a stock exchange scenario. Multiple stocks can be registered at a stock exchange. There will be stock observers who are observing some specific stocks....
3
votes
0answers
58 views

News reading application version 2

following the answer I got from t3chb0t last time News-reading application using the Observer pattern and also following the example here https://msdn.microsoft.com/en-us/library/dd990377(v=vs.110)....
4
votes
1answer
686 views

Simple event dispatcher

Here is my very first event dispatcher. I would like to get both, style and code review, as well as some ideas to improve this implementation (new features etc.) I tried to write code in C++17 style ...
3
votes
1answer
167 views

Angular service for fetching and passing data with observables

I have an Angular service consisting of three methods: This method makes a call to my server to get a URL ...
3
votes
2answers
177 views

Make an Array Reactive (Observable)

I have written a simple JavaScript function to make an array reactive (i.e. observable). Is there anything I could improve? What the code does is take an array, a callback and a ...
2
votes
1answer
59 views

JavaScript and RxJS Password Strength Indicator

This is my first time using RxJS (or any observable library). It seems to work okay but I'm not sure about best practices. The thing that I am most unsure about is subscribing to the observable ...
5
votes
1answer
105 views

Scheduling using System.IObservable 2.0

As a follow up to this first attempt to create and use my own IObservable<T> implementation, this is version 2.0. The goal has been to correct the code where ...
4
votes
1answer
116 views

Scheduling using System.IObservable

With great inspiration from t3chb0ts ongoing work about scheduling, cron jobs etc. (last post here), I decided to make my own version of the Scheduler - using the observer pattern - as a learning ...
5
votes
0answers
136 views

Scheduler built with observables v2 (follow-up)

It would probably be too easy if the old Scheduler worked as intended being that simple. But an eye-openig review showed that from time to time it'll miss one ...
4
votes
2answers
526 views

Scheduler built with observables

I sometimes have to schedule some tasks and wanted to have my own reusable scheduler. Since I like the Rx, I build it on top of it. Follow-up There is a newer version of the ...
4
votes
1answer
2k views

Java Pub Sub implementation using broker

I have developed a simple pubsub event subscription in java. Something similar to this thread Simple Pub-Sub Event Emitter These are the goals. Class should be able to "listen" to events happening ...
1
vote
0answers
39 views

Fetching student and teacher data from a given date range

I have two APIs which fetch data of teachers and students from a given date range. I am using forkJoin to get both APIresponse and display the data with a regular interval of 10 ms. This is working ...
1
vote
2answers
68 views

JavaScript library to notify watchers of changes

Background Last year, while I was still entering the beginning of Immutability and Pure functions and whatnot I created a library for the community called ...
1
vote
0answers
64 views

Subscribing to multiple sources in RxJava

I have used RxJava to Observe multiple sources and then perform action depending upon values of Observables. I want to know if it can be further simplified. Goal: Complete implementation of RxJava. ...
2
votes
1answer
295 views

Implementation of observer pattern for Node.js

I wrote an implementation of observer pattern as part of my online battle Chess game: ...
1
vote
2answers
1k views

Observable implementation

I have implemented a simple Observable class. I think that there is still room for improvement. Especially the fact that I have separate array to observe results ...
3
votes
1answer
786 views

Implementation of Observable with multiple callback function signatures

I have been playing around with ways of implementing a generic class for supporting the observer pattern. I have already asked to review a basic approach here. Now I have come up with an Observable ...
4
votes
1answer
1k views

Implementation of Observer Pattern in C++14

I have written a small class for implementing the observer pattern in C++(14). I would welcome any comments, corrections criticisms and suggestions. Observable.h: ...
8
votes
1answer
1k views

Observer pattern implementation in C++11

Can this observer pattern implementation be improved? Problem: User will drive a car if pressed l --> car move left c--> move middle ,r--> move right ...
5
votes
2answers
796 views

C++ implementation of the observer design pattern

Started learning design patterns using C++. Below is an implementation of the Observer Pattern. Two abstract class templates Observer and ...
2
votes
1answer
892 views

Angular - reusing an observable for different queries

This is just a dummy example, but in my real world application I get a lot of data from the web API and I'd like to manipulate it on the client's side. So, I kind of stored the observable I get from ...
4
votes
1answer
587 views

Observable Logger

I'm experimenting with an alternative abstraction layer for logging that is build on top of the Reactive Extensions. This allows me to easily add features I need to my layer and map logs to any other ...
9
votes
2answers
774 views

Retry and CircutBreaker the reactive way

I wrote a simple utility for Retry and CircuitBreaker patterns. I implemented it by using ReactiveX because I thought it might actually be the perfect framework for it. I know that there is a project ...
2
votes
1answer
86 views

Store first value of http request with rxjs but keep doing httprequest

With RXJS library : I need to store values from the FIRST http request, but keep doing other http request on demand. I have done this code so far, and that is working. But I think there is a more ...
1
vote
0answers
1k views

Simple chat client and server in Java. (tried to refactor on Head First Java code example)

In the book Head First Java there was this coding example that created a very simple chat client and server. Both the server and the client consisted of just one class. I left the server code as is, ...
2
votes
0answers
105 views

Network of senders and receivers in C++

I am trying to create a Sender-Receiver Network. What do I mean under a Sender-Receiver Network. That means that there is some structure which consists of Nodes and connections between them which will ...
0
votes
2answers
812 views

Angular2/4 broadcast service using RxJS

I am no expert in RxJS as I am still learning my way around the new paradigm of Observable/Subject. I was trying to implement a broadcast service (based on NgRadio) that allows a new subscriber to ...
1
vote
2answers
81 views

Lightweight flexible observer framework using weak references

I found a need for a simple, generic publish-subscribe framework for my Java application. I looked over a few implementations on Code Review and I think mine avoids most of the pitfalls. Single-...
3
votes
0answers
129 views

F# Observable.subscribeWeakly implementation

In this SO question I needed an observable subscription function that can be used kind of like Observable.subscribe, but that does not keep a strong reference to ...
7
votes
0answers
326 views

Observable Object

I have created an observer and an observable object class. The idea being that you can create an observer that does some action whenever object being observed changes value. Design goals: Be able ...
0
votes
1answer
294 views

Merging union Observables

I am having a scenario where I need to execute observables that depends on the result of the first one. However I need to keep the result of the first observable. I couldn't find any extension that ...
3
votes
0answers
257 views

Simple C++11 Subject-Observer

Building on the answer in C++ class member callback simple examples, I've tried to put together a simple subject-observer pattern without needing to inherit a virtual Observer class. I also wanted to ...
1
vote
1answer
471 views

Observer pattern for temperature and pressure sensors

I have tried to implement the observer pattern. The code should be able to handle a variable number of observables (set compile time) and notify any number of observers/registerables. Any observable ...
10
votes
1answer
21k views

Angular 2 clock with RxJS Observable

I'm fairly new to Angular 2 and I started off with creating a clock for my app. I tried to stick to the official documentation tutorial. Folder structure: The CSS file is still empty and the HTML is ...
3
votes
2answers
3k views

Observer pattern using a set of observers and delegated properties

The idea is to implement the observer pattern, with a separate notification method for each observed property of the observed object. Let me start with a simplified use case: ...
3
votes
2answers
580 views

Reusable Implementation of the Publish-Subscribe Pattern

I've finished an implementation of what I believe the Publish-Subscribe pattern is for practice and possible use in personal projects even though this implementation is fairly similar to the Observer/...
0
votes
1answer
536 views

WPF async ObservableTaskQueue class

I'm currently working on a WPF application, making calls to various web APIs. Thus, I'm looking after a special observable tasks queue: Progress value must be available Tasks (API calls)/seconds must ...
2
votes
1answer
106 views

Removing same event from listener

I have a myDiv.mousedown, window.mousemove, and window.mouseup event. I'm trying to organize ...
2
votes
2answers
199 views

Brightness adjustment control for multiple UI elements

I have an application that basically exists as a map and some controls. The controls change the look and feel of the map. I have a slider which is used to change the brightness, for example. At the ...
4
votes
2answers
144 views

TextBoxes for various number types

Is there a way I could somehow have all this classes condensed into one, while keeping the code as clean as possible? They are all doing essentially the same thing, just for the different number type....
2
votes
1answer
113 views

Using a new thread to post to observers

I have implemented my own Observer pattern. I want to post my events in a new thread. This thread would simply call all the the observers/listeners with the posted event. ...