From 5206eed8e5f53b8db5ac6b22dc74bb6d0d1a1f94 Mon Sep 17 00:00:00 2001 From: Micooz Date: Sun, 1 May 2016 21:27:17 +0800 Subject: [PATCH] deprecate vars outside class --- src/APlayer.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/APlayer.js b/src/APlayer.js index 87921e7..61c5b6c 100644 --- a/src/APlayer.js +++ b/src/APlayer.js @@ -1,5 +1,4 @@ -(() => { - let APlayers = []; +((instances) => { class APlayer { /** @@ -404,8 +403,8 @@ this.setMusic(0); - APlayers.push(this); - }; + instances.push(this); + } /** * Set music @@ -557,9 +556,9 @@ // pause other players (Thanks @Aprikyblue) if (this.option.mutex) { - for (let i = 0; i < APlayers.length; i++) { - if (this != APlayers[i]) { - APlayers[i].pause(); + for (let i = 0; i < instances.length; i++) { + if (this != instances[i]) { + instances[i].pause(); } } } @@ -613,4 +612,4 @@ else { window.APlayer = APlayer; } -})(); \ No newline at end of file +})([]); \ No newline at end of file