前端开发

observer-pattern

patternsdev/skills

Teaches the observer pattern for event-driven communication. Use when you need decoupled publish/subscribe behavior where multiple parts of your system react to state changes or events.

  • 639 次安装
  • 257 星标
  • 收录于

安装命令

npx skills add https://github.com/patternsdev/skills --skill observer-pattern

SKILL.md

Observer Pattern

Table of Contents

With the observer pattern, we can subscribe certain objects, the observers, to another object, called the observable. Whenever an event occurs, the observable notifies all its observers!

When to Use

  • Use this when you need to notify multiple parts of an application about state changes or events
  • This is helpful for implementing event-driven, asynchronous communication between components

When NOT to Use

Observer Pattern

Table of Contents

With the observer pattern, we can subscribe certain objects, the observers, to another object, called the observable. Whenever an event occurs, the observable notifies all its observers!

When to Use

  • Use this when you need to notify multiple parts of an application about state changes or events
  • This is helpful for implementing event-driven, asynchronous communication between components

When NOT to Use