node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



Run code in particular circumstances

What is Snowflake?

Snowflake lets you run a piece of code once, or every so often. It is useful for debugging a function that is run frequently.

<script type="text/javascript" src="snowflake.js"></script>
<script type="text/javascript">
  var problemFn = function() {
    var interestingVar = 0;
    // print out interestingVar once, even though problemFn is run more than once 
    snowflake.once(function() {
    // print out interestingVar every two seconds 
    snowflake.every(function() {
    }, 2000);
  while(true) {

Get the code