GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - bitbound/SimpleMessenger: A simple, lightweight event messenger where handlers are automatically removed when subscriber is GCed.

BranchesTags
Open more actions menu

Latest commit

 

History

48 Commits
48 Commits

Folders and files

NameName
Last commit message
Last commit date
.assets
.assets
 
 
.github/workflows
.github/workflows
 
 
Bitbound.SimpleMessenger.Tests
Bitbound.SimpleMessenger.Tests
 
 
Bitbound.SimpleMessenger
Bitbound.SimpleMessenger
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
Bitbound.SimpleMessenger.slnx
Bitbound.SimpleMessenger.slnx
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 

Repository files navigation

SimpleMessenger

A simple, lightweight event messenger that uses a ConditionalWeakTable internally. Handlers are automatically removed when the subscriber is garbage-collected.

NuGet: https://www.nuget.org/packages/Bitbound.SimpleMessenger

Usage

// Program.cs
using Bitbound.SimpleMessenger;

// ...

services.AddSingleton<IMessenger>(WeakReferenceMessenger.Default);
// MyService.cs

public class MyService : IMyService
{
    public MyService(IMessenger messenger)
    {
        // Registers a handler under the default channel.
        // The handler will be removed automatically if
        // this MyService instance is garbage-collected.
        messenger.Register<SomeMessageType>(this, MyHandler);
    }

    private async Task MyHandler(object subscriber, SomeMessageType message)
    {
        // Handle the message.
    }
}

About

A simple, lightweight event messenger where handlers are automatically removed when subscriber is GCed.

Resources

Readme
MIT license
Activity

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.