From 1f0b1bf28d79cfa60a410f8d6ac478265ad41431 Mon Sep 17 00:00:00 2001 From: returnworld Date: Tue, 19 Nov 2024 07:24:26 +0500 Subject: [PATCH] Update timer.md the example from the documentation gives an error: Uncaught TypeError: Cannot read properties of undefined (reading 'add') TypeError: Cannot read properties of undefined (reading 'add') --- docs/timer.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/timer.md b/docs/timer.md index 4a3d8bb..1a0672c 100644 --- a/docs/timer.md +++ b/docs/timer.md @@ -27,11 +27,16 @@ new CtTimer 1000, 'test' ```js // Create a new timer and remember it in a variable `timer` // Log "Done!" when it gets to 2.5 seconds -var timer = timer.add(2500, 'test'); -timer.then(() => { +timer.add(2500, 'test').then(() => { // Do something useful - hero.invincible = false; - console.log('Done!'); + console.log(timer); + console.log('Done! timer test'); +}) +// or +var timer1 = new CtTimer(1110, 'test'); +timer1.then(() => { + // Do something useful + console.log('Done! timer1'); }) // The `catch` part is not necessary. Without it, though, you will // see errors in the console when timers got interrupted,