Full blown example.
This commit is contained in:
@ -66,7 +66,7 @@
|
||||
};
|
||||
|
||||
const emulatorInit = data => {
|
||||
EJS_gameUrl = data.game;
|
||||
EJS_gameUrl = `/api/v1/rom?id=${data.gameId}`;
|
||||
EJS_core = data.core;
|
||||
EJS_gameName = data.gameName;
|
||||
|
||||
@ -88,34 +88,35 @@
|
||||
}
|
||||
|
||||
const { message } = data;
|
||||
|
||||
switch(message) {
|
||||
case 'init':
|
||||
emulatorInit(data);
|
||||
break;
|
||||
|
||||
case 'volume':
|
||||
EJS_emulator.setVolume(data.volume);
|
||||
break;
|
||||
|
||||
default:
|
||||
console.error('Unknown message', message);
|
||||
}
|
||||
};
|
||||
|
||||
EJS_ready = (...args) => {
|
||||
send({ message: 'ready', data: args });
|
||||
EJS_ready = () => {
|
||||
send({ message: 'ready' });
|
||||
}
|
||||
|
||||
EJS_onSaveState = (...args) => {
|
||||
send({ message: 'save', data: args });
|
||||
EJS_onSaveState = () => {
|
||||
send({ message: 'save' });
|
||||
}
|
||||
|
||||
EJS_onLoadState = (...args) => {
|
||||
send({ message: 'load', data: args });
|
||||
EJS_onLoadState = () => {
|
||||
send({ message: 'load' });
|
||||
}
|
||||
|
||||
EJS_onGameStart = (...args) => {
|
||||
send({ message: 'start', data: args });
|
||||
EJS_onGameStart = () => {
|
||||
send({ message: 'start' });
|
||||
}
|
||||
|
||||
</script>
|
||||
<!-- <script src="https://cdn.emulatorjs.org/stable/data/loader.js"></script> -->
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user