ComfyVars
Super-Easy Observable (and Debuggable!) Values in Javascript! It's like push notifications for your variables. ComfyVars lets you add a callback event to be notified whenever a value is changed in your object.
var normalObject = {}; // no callbackvar comfyObject = ComfyVars; // YES CALLBACK!
Instafluff
Come and hang out with us at the Comfiest Corner on Twitch!
Instructions
Node
- Install
comfyvars
npm install comfyvars --save
- Create watchable objects using ComfyVars
var ComfyVars = ;var example = ComfyVars;examplename = "Hello World";// This will output: "Watching: name Hello World"
Browser
- Add
comfyvars.js
<script src="comfyvars.min.js"></script>
- Create watchable objects using ComfyVars
Example
var player = ComfyVars;playername = "Instafluff";playerxp = 0; { if playerxp > 5 console; } playerxp += 5;playerxp += 5; // Console: Level up!
Debug Values
You can also debug values easily by creating a Debuggable
:
var debug = ComfyVars;debugtest = "Debug World";var testGet = debug "test" ;/* This will output: DEBUG: test = Debug World*/
Initial Value
Values can be initialized by passing in the object as a parameter:
var debug = ComfyVars;var testGet = debug "test" ; var player = ComfyVars; { if playerxp > 5 console; }playerxp += 10;