Skip to main content

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.

19 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7 votes
0 answers

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 ...
t3chb0t's user avatar
  • 44.3k
4 votes
0 answers

Create IObservable<T> From Func<T>

These extensions create an IObservable<T> that creates a long running task that can be cancelled. It runs the Func<T>...
Christian Findlay's user avatar
4 votes
0 answers

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 ...
t3chb0t's user avatar
  • 44.3k
3 votes
0 answers

Android BMI calculator using LiveData

I have made a Body mass index-calculator using ViewModel and LiveData. Source-code of the MainActivity: ...
michael.zech's user avatar
  • 4,358
3 votes
0 answers

Observer pattern over FFI

I'm trying to write up a cross-platform rust library (one, that will be used in iOS/Mac/Android dev etc.) It is based largely on concept's and code from Mozilla. One of the requirements I have is to ...
georgemp's user avatar
  • 131
3 votes
0 answers

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. ...
Adrian Brand's user avatar
3 votes
0 answers

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 ...
cmeeren's user avatar
  • 185
3 votes
0 answers

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 ...
rsjaffe's user avatar
  • 253
3 votes
0 answers

JSON Data Observer

I wrote a small piece of code for observing changes on JSON object. Whenever there is a change in Object, it should trigger all the handlers with simplistic information about data change. I am ...
SoI's user avatar
  • 175
2 votes
0 answers

NativeScript - Angular Service to watch iOS keyboard event listeners

I'm writing an app with NativeScript 6.4.1 and Angular version 8. There are a series of UI events in iOS that you can watch to see what the keyboard is doing:
user1261710's user avatar
2 votes
0 answers

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 ...
Darius Duesentrieb's user avatar
2 votes
0 answers

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 ...
paraxod's user avatar
  • 31
2 votes
0 answers

Updating the coordinates of items possessed by a moving person

A Person has coordinates and an Item has coordinates as well, and hence both are derived from ...
prestokeys's user avatar
  • 1,371
1 vote
0 answers

Unity3D Observable Variables as ScriptableObjects

I'm trying to implement an observable pattern on variables, so that I can hook up UI components, etc. to change displayed values or other actions when their value changes. I wanted three features that ...
Tom's user avatar
  • 223
1 vote
0 answers

Observer Design Pattern in Golang

I am trying to practice the Observer design pattern in Golang, here is my code. I would be pleased to receive your comments, improvements, etc. ...
Mazdak's user avatar
  • 191
1 vote
0 answers

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 ...
av0000's user avatar
  • 111
1 vote
0 answers

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) ...
NoProg's user avatar
  • 23
1 vote
0 answers

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, ...
Rick's user avatar
  • 195
0 votes
0 answers

Rust Observer/Subscriber design pattern

I have written a sample Observer/Subscriber design pattern where, in my application there is a networ_receiver thread, ...
Harry's user avatar
  • 429