10 examples of 'react native setinterval' in JavaScript

Every line of 'react native setinterval' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
17componentDidMount() {
18 if (this.props.enabled) {
19 this.start();
20 }
21}
29function SetInterval() {
30 this.key = {};
31
32 /**
33 * @param {Function} fn
34 * @param {Number} interval
35 * @param {String} key
36 */
37 this.start = function start(fn, interval, key) {
38 if (!this.key[key]) {
39 this.key[key] = setInterval(function () {
40 fn();
41 }, interval);
42 }
43 }
44
45 /**
46 * @param {String} key
47 */
48 this.clear = function clear(key) {
49 if (this.key[key]) {
50 clearInterval(this.key[key]);
51 delete this.key[key];
52 }
53 }
54}
68export function setInterval(callback, repeat) {
69 var args = arguments;
70 var timer = setTimeout.apply(null, args);
71 var wrapper = function() {
72 var new_timer = setTimeout.apply(null, args);
73 timer.task = new_timer.task;
74 timer.task.callback = wrapper;
75
76 callback.apply(null, arguments);
77 };
78 timer.task.callback = wrapper;
79 return timer;
80}
25setInterval (interval) {
26 this.options.interval = interval
27 return this;
28}
20componentDidMount() {
21 setInterval(this.countingSecond, 1000);
22}
11componentDidMount() {
12 this.interval = setInterval(this.props.onTick, 1000);
13}
11setInterval(callback: Function, timeout: number, ...args: any[]) {
12 const intervalID = setInterval(callback, timeout, ...args);
13 this._timerIDs.set(intervalID, clearInterval);
14 return intervalID;
15}
24function setInterval(callback, duration) {
25 if(!callback) return;
26
27 var id = window.timerID++;
28 var info = {id:id, callback:callback};
29
30 info.duration = duration/1000;
31 info.timeout = window.tickTime + info.duration;
32
33 window.intervalFuncs[id] = info;
34
35 return id;
36}
84function setInterval(fn, duration) {
85 var t = getTime();
86 var callback = function() {
87 var t2 = getTime();
88 if (t2 - t >= duration) {
89 fn.apply(this, arguments);
90 t = getTime();
91 }
92 };
93 return addTimerFunction(callback);
94}
44function setInterval(callback, delay, var_args) {};

Related snippets