vuepress-plugin-chiptune 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vuepress-plugin-chiptune",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "A VuePress plugin for Chiptune music generation.",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/Chiptune.vue CHANGED
@@ -74,13 +74,16 @@
74
74
  </template>
75
75
 
76
76
  <script>
77
- import { init, generateLoop, modifySounds, remixLoop, togglePlayPause, downloadWav, exportMIDI, triggerRandom } from './neoloop.js';
77
+ import { init, generateLoop, modifySounds, remixLoop, togglePlayPause, downloadWav, exportMIDI, triggerRandom, stopMusic } from './neoloop.js';
78
78
 
79
79
  export default {
80
80
  name: 'Chiptune',
81
81
  mounted() {
82
82
  init();
83
83
  },
84
+ beforeUnmount() {
85
+ stopMusic();
86
+ },
84
87
  methods: {
85
88
  generateLoop,
86
89
  modifySounds,
package/src/neoloop.js CHANGED
@@ -478,7 +478,7 @@ function playMusic() {
478
478
  togglePlay.textContent = "Stop";
479
479
  }
480
480
 
481
- function stopMusic() {
481
+ export function stopMusic() {
482
482
  if (source) {
483
483
  source.stop();
484
484
  if (source._interval) clearInterval(source._interval);