@jdeighan/coffee-utils 4.1.26 → 4.1.27

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jdeighan/coffee-utils",
3
3
  "type": "module",
4
- "version": "4.1.26",
4
+ "version": "4.1.27",
5
5
  "description": "A set of utility functions for CoffeeScript",
6
6
  "main": "coffee_utils.js",
7
7
  "exports": {
@@ -48,6 +48,7 @@
48
48
  "ava": "^3.15.0",
49
49
  "cross-env": "^7.0.3",
50
50
  "js-yaml": "^4.1.0",
51
- "readline-sync": "^1.4.10"
51
+ "readline-sync": "^1.4.10",
52
+ "svelte": "^3.46.3"
52
53
  }
53
54
  }
@@ -1,5 +1,7 @@
1
1
  # svelte_utils.coffee
2
2
 
3
+ import {onDestroy} from 'svelte'
4
+
3
5
  # ---------------------------------------------------------------------------
4
6
  # svelteSourceCodeEsc - to display source code for a *.starbucks page
5
7
 
@@ -24,3 +26,9 @@ export svelteHtmlEsc = (str) ->
24
26
 
25
27
  # ---------------------------------------------------------------------------
26
28
 
29
+ export onInterval = (func, secs) ->
30
+
31
+ interval = setInterval(func, Math.floor(1000 * secs))
32
+
33
+ onDestroy () ->
34
+ clearInterval interval
@@ -1,5 +1,8 @@
1
1
  // Generated by CoffeeScript 2.6.1
2
- // svelte_utils.coffee
2
+ // svelte_utils.coffee
3
+ import {
4
+ onDestroy
5
+ } from 'svelte';
3
6
 
4
7
  // ---------------------------------------------------------------------------
5
8
  // svelteSourceCodeEsc - to display source code for a *.starbucks page
@@ -14,3 +17,10 @@ export var svelteHtmlEsc = function(str) {
14
17
  };
15
18
 
16
19
  // ---------------------------------------------------------------------------
20
+ export var onInterval = function(func, secs) {
21
+ var interval;
22
+ interval = setInterval(func, Math.floor(1000 * secs));
23
+ return onDestroy(function() {
24
+ return clearInterval(interval);
25
+ });
26
+ };