R
Size: a a a
З🧟
З🧟
З🧟
З🧟
R
import SuperClass from './SuperClass';
import { Howl } from 'howler';
export default class MyClass extends SuperClass {
constructor(init) {
super(init);
this.init = (init?.name) || this.constructor.name;
console.log(init.name)
this.obj = {};
this.arr = [];
this.str = '';
this.sound = 'https://sethares.engr.wisc.edu/mp3s/simptun3.mp3';
}
/* past_new_method */
player(init) {
const { url } = init;
// var sound = new Howl({
// src: ['https://interactive-examples.mdn.mozilla.net/media/examples/t-rex-roar.mp3'],
// volume: 0.5,
// onend: function () {
// alert('Finished!');
// }
// });
console.log(Howl);
const config = {
src: [String(url)],
volume: 1,
format: 'mp3',
};
const audio = new Howl(config);
audio.play();
}
/* past_code_here */
async run() {
try {
this.player({
// url: 'https://www.youtube.com/watch?v=HEXWRTEbj1I',
url: this.sound,
});
const result = { name: await this.init };
console.info('RUN', result);
return this.$$goodAnswer(result);
} catch (err) {
this.__console(err);
return this.$$badAnswer(err);
}
}
}
new MyClass().run();
S
import SuperClass from './SuperClass';
import { Howl } from 'howler';
export default class MyClass extends SuperClass {
constructor(init) {
super(init);
this.init = (init?.name) || this.constructor.name;
console.log(init.name)
this.obj = {};
this.arr = [];
this.str = '';
this.sound = 'https://sethares.engr.wisc.edu/mp3s/simptun3.mp3';
}
/* past_new_method */
player(init) {
const { url } = init;
// var sound = new Howl({
// src: ['https://interactive-examples.mdn.mozilla.net/media/examples/t-rex-roar.mp3'],
// volume: 0.5,
// onend: function () {
// alert('Finished!');
// }
// });
console.log(Howl);
const config = {
src: [String(url)],
volume: 1,
format: 'mp3',
};
const audio = new Howl(config);
audio.play();
}
/* past_code_here */
async run() {
try {
this.player({
// url: 'https://www.youtube.com/watch?v=HEXWRTEbj1I',
url: this.sound,
});
const result = { name: await this.init };
console.info('RUN', result);
return this.$$goodAnswer(result);
} catch (err) {
this.__console(err);
return this.$$badAnswer(err);
}
}
}
new MyClass().run();