1.4.9 • Published 8 months ago

badmfck-signal v1.4.9

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

#An implementation of a signaling mechanism used to connect components and transfer data between them

How to use: Create an instance of Signal with prefered data type: const S_TEST:Signal=new Signal()

Subscribe to signal, obtain callback id. const callbackID = S_TEST.subscribe(str=>{console.log(str)})

Call invokation procedure S_TEST.invoke("test")

Remove subscribtion, using id: S_TEST.remove("test1")

Remove all subscribtions from signal: S_TEST.clear();

shortcuts:

Subscribe to signalling pipe with name stored in group. group is optional, if not exists, global pipeline will use s_subscribe(group)

s_unsubscribe(id) unsubscribe from signal

The main principle is using one point in project to store all major interactions between sources without connectig them directly, also called as GlobalDispatcher or Spine.

example: file: GlobalDispatcher.ts export class GD{ static S_SAVE_DATA:Signal=new Signal(); }

file: DataManager.ts export GD from './GD' export class DataManager{ constructor(){ GD.S_SAVE_DATA.subscribe(data=>{ console.log(${data} saved!) }) } }

file: ViewController.ts export GD from './GD' button.onClick=()=>{ GD.S_SAVE_DATA.invoke("Test!") }

1.4.9

8 months ago

1.4.8

8 months ago

1.4.7

8 months ago

1.4.5

1 year ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.3.9

2 years ago

1.3.8

2 years ago

1.3.7

2 years ago

1.3.6

2 years ago

1.3.5

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.2.9

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.9

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago