From 7f388aae13ac6c045f8c92c26f134b2ce8c1a8cd Mon Sep 17 00:00:00 2001 From: jimczj Date: Mon, 22 Jun 2020 14:05:06 +0800 Subject: [PATCH] =?UTF-8?q?doc:=20=E5=AE=8C=E5=96=84=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 81af9bf..5e1d8e8 100644 --- a/README.md +++ b/README.md @@ -22,12 +22,15 @@ import { TimerBehavior } from 'timer-miniprogram' Page({ behaviors: [TimerBehavior], onReady() { - this.$setTimeout(() => { + const timer1 = this.$setTimeout(() => { console.log('setTimeout') }) - this.$setInterval(() => { - console.log('setTimeout') + this.$clearTimeout(timer1) + + const timer2 = this.$setInterval(() => { + console.log('setInterval') }) + this.$clearInterval(timer2) } }) @@ -35,12 +38,15 @@ Page({ Components({ behaviors: [TimerBehavior], ready() { - this.$setTimeout(() => { + const timer1 = this.$setTimeout(() => { console.log('setTimeout') }) - this.$setInterval(() => { - console.log('setTimeout') + this.$clearTimeout(timer1) + + const timer2 = this.$setInterval(() => { + console.log('setInterval') }) + this.$clearInterval(timer2) } }) ```