Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Flux and event emitter with .net MVC?

I am trying to learn the Flux pattern.

I learned to use React with .net MVC and rendered it server side.

I would like to learn Flux but all tutorials use node js.

I don't use node.

I don't know how to implement the Event Emitter part because it uses a node function.

https://www.codementor.io/reactjs/tutorial/react-js-flux-architecture-tutorial

About a 1/3 of the way down:

"Event Emitter – The event emitter is responsible for notifying subscribers after a store has completed any data action. Conversely, it also needs to be able to register observers for specific events. We’re going to be using Node’s event emitter in the todo application."

Given that Flux is simply a pattern, is there something that I can use with .net MVC, in the absence of node, to handle the Event Emitter part?

Thoughts appreciated, thanks.

like image 830
nanonerd Avatar asked Jul 23 '15 23:07

nanonerd


1 Answers

You can use .NET Delegates, which is well documented here https://msdn.microsoft.com/en-us/library/edzehd2t%28v=vs.110%29.aspx

Delegates are multicast, which means that they can hold references to more than one event-handling method.

This will of course be a server-side implementation of the Flux pattern.

like image 103
MattDuFeu Avatar answered Oct 02 '22 12:10

MattDuFeu