Skip to content

Instantly share code, notes, and snippets.

@scripting
Created September 5, 2019 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scripting/a1108dd5a394c1e1886d4fc6bbcfcbdf to your computer and use it in GitHub Desktop.
Save scripting/a1108dd5a394c1e1886d4fc6bbcfcbdf to your computer and use it in GitHub Desktop.
{
"name": "test",
"description": "Test app for persists package.",
"author": "Dave Winer <dave@scripting.com>",
"license": "MIT",
"version": "0.4.0",
"dependencies" : {
"persists": "*"
}
}
const utils = require ("daveutils");
const persists = require ("persists");
var initialstats = {
ct: 0,
slogan: "",
randomNumber: 0
};
var stats;
function everySecond () {
stats.ct++;
stats.slogan = utils.getRandomSnarkySlogan ();
stats.randomNumber = utils.random (0, 10000);
}
persists ("stats", initialstats, function (theProxy) {
stats = theProxy;
setInterval (everySecond, 1000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment