From 3c603ddddca84c3f8c2d1fba32c2ac683ec73289 Mon Sep 17 00:00:00 2001 From: Robert Balejik Date: Fri, 27 Mar 2020 11:00:00 +0100 Subject: [PATCH] Update text.md explanation of how StopOthers work - was bit unclear have to console.log audio, current to see the diff. --- .../content/tutorial/17-module-context/01-sharing-code/text.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/site/content/tutorial/17-module-context/01-sharing-code/text.md b/site/content/tutorial/17-module-context/01-sharing-code/text.md index 3529544fed..92da48f5b1 100644 --- a/site/content/tutorial/17-module-context/01-sharing-code/text.md +++ b/site/content/tutorial/17-module-context/01-sharing-code/text.md @@ -22,3 +22,6 @@ function stopOthers() { current = audio; } ``` +``I was bit confused about this lesson - have to console.log(current - audio) to see difference.`` I press Play for 1st time (current is set to corresponding audio tag, e.g current = "Danube waltz"). +Then I cick play on other track (audio = Mars) which, triggers "stopOthers" function. That checks if there's some track playing (current is "set" - not null) ``and now the part that was bit magic at 1st`` and whether the 'active' audio tag (Mars) I just clicked !== current (currently playing Waltz). +The statement is true => currently playing Waltz is paused, "active" Mars starts playing and current = "Mars".