Skip to content

My take on signals in vanilla JS, with (semi) type safety. Put together in a short amount of time, so kind of a mess

Notifications You must be signed in to change notification settings

Chrille0234/signals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How to Use

Create a new instance of Signal

let aSignal = new Signal(initial_value, variable_name);

initial_value: The initial value for your signal.

variable_name: The name of the variable you will use in your HTML, surrounded by pipes.

Wrap the Signal in your HTML

<p>Signal value: |variable_name|</p>

Replace variable_name with the name you provided when creating the Signal instance.

Update the Value

aSignal.value = "new value";

You can change the value at any time using the value property. Note: The type of the value (string, number...) cannot be changed once set.

About

My take on signals in vanilla JS, with (semi) type safety. Put together in a short amount of time, so kind of a mess

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published