@saooti/octopus-sdk 29.0.26 → 30.0.0

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": "@saooti/octopus-sdk",
3
- "version": "29.0.26",
3
+ "version": "30.0.0",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -97,8 +97,28 @@ export default defineComponent({
97
97
  return '';
98
98
  },
99
99
  },
100
+ created(){
101
+ window.addEventListener('keydown', this.addKeyboardControl);
102
+ },
103
+ beforeUnmount() {
104
+ window.removeEventListener('keydown', this.addKeyboardControl);
105
+ },
100
106
 
101
107
  methods: {
108
+ addKeyboardControl(event: KeyboardEvent): void{
109
+ if (' ' === event.key || 'Spacebar' === event.key) {
110
+ event.preventDefault();
111
+ this.switchPausePlay();
112
+ }else if ('ArrowRight' === event.key && event.ctrlKey) {
113
+ const audioPlayer: HTMLAudioElement|null = document.querySelector('#audio-player');
114
+ if(!audioPlayer){return;}
115
+ audioPlayer.currentTime += 15;
116
+ }else if ('ArrowLeft' === event.key && event.ctrlKey) {
117
+ const audioPlayer: HTMLAudioElement|null = document.querySelector('#audio-player');
118
+ if(!audioPlayer){return;}
119
+ audioPlayer.currentTime -=15;
120
+ }
121
+ },
102
122
  switchPausePlay(): void {
103
123
  const audioPlayer: HTMLAudioElement|null = document.querySelector('#audio-player');
104
124
  if(!audioPlayer){return;}