Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-observer-pattern

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-observer-pattern - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

src/index.ts

3

index.ts

@@ -1,2 +0,1 @@

import {Observer} from "./Observer"
import {Subject} from "./Subject"
export * from './src/index'
{
"name": "ts-observer-pattern",
"version": "3.0.0",
"version": "3.1.0",
"description": "Interfaces to help working with the Observer Pattern",

@@ -5,0 +5,0 @@ "main": "index.ts",

# ts-observer-pattern
A simple observer pattern implementation in TypeScript.
```npm install ts-observer-pattern```
```
npm install ts-observer-pattern
```
# Example
## Example
In the example that follows, I'm implementing a relationship bettween a magazine and it subscribers
```
```TypeScript
// Magazine.ts
import { Subject } from 'ts-observer-pattern'
class Magazine extends Subject

@@ -24,3 +29,6 @@ {

```
```TypeScript
// Subscriber.ts
import { Observer } from 'ts-observer-pattern'
class Subscriber implements Observer

@@ -35,3 +43,7 @@ {

```
```TypeScript
// main.ts
import { Magazine } from './Magazine'
import { Subscriber } from './Subscriber'
let Coders = new Magazine

@@ -38,0 +50,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc