Skip to content

Commit

Permalink
🚧 #35 first attempt to correct the memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
JAGFx committed Oct 4, 2020
1 parent faa07b6 commit 08720e8
Show file tree
Hide file tree
Showing 7 changed files with 597 additions and 588 deletions.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var noSleep = new NoSleep();

$( 'html' ).on( 'click', '#overlay', function () {
console.log( 'Plop' );
//console.log( 'Plop' );
var elem = document.querySelector( 'html' );

/* View in fullscreen */
Expand Down
119 changes: 57 additions & 62 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<template>
<main :class="`${telemetry.game && telemetry.game.game.id === 2 ? 'ats' : 'ets2'}`">
<b-overlay :show="!gameConnected" :variant="'dark'" no-wrap>
<template v-slot:overlay>
<div class="d-flex justify-content-center flex-column align-items-center">
<transition mode="out-in" name="slide-fade">
<div :key="launching.text" class="d-flex justify-content-center align-items-center flex-column">
<h1><span class="mb-3" v-html="launching.icon"></span></h1>
<h1>{{ launching.text }}</h1>
<small class="mb-3">{{ launching.subText }}</small>
<b-spinner label="Processing..." type="grow"></b-spinner>
</div>
</transition>
</div>
</template>
</b-overlay>

<OverlayElement v-if="gameConnected"></OverlayElement>
<EventOverlayElement v-if="gameConnected"></EventOverlayElement>
<Game id="game" v-if="gameConnected" />
<div class="wrapper menu h-100" v-if="gameConnected" v-show="menuIsDisplayed()">
<Menu></Menu>
</div>
<component v-bind:is="currentSkinComponent()" v-if="gameConnected" v-show="!menuIsDisplayed()"></component>
<!--<Events id="events" v-bind="{log}" />-->
<!--<Controls id="controls" v-bind="{...controls, transmission: truck.transmission}" />-->
</main>
<template v-slot:overlay>
<div class="d-flex justify-content-center flex-column align-items-center">
<transition mode="out-in" name="slide-fade">
<div :key="launching.text" class="d-flex justify-content-center align-items-center flex-column">
<h1><span class="mb-3" v-html="launching.icon"></span></h1>
<h1>{{ launching.text }}</h1>
<small class="mb-3">{{ launching.subText }}</small>
<b-spinner label="Processing..." type="grow"></b-spinner>
</div>
</transition>
</div>
</template>
</b-overlay>

<OverlayElement v-if="gameConnected"></OverlayElement>
<EventOverlayElement v-if="gameConnected"></EventOverlayElement>
<Game id="game" v-if="gameConnected" />
<div class="wrapper menu h-100" v-if="gameConnected" v-show="menuIsDisplayed">
<Menu></Menu>
</div>
<component v-bind:is="currentSkinComponent()" v-if="gameConnected" v-show="!menuIsDisplayed"></component>
<!--<Events id="events" v-bind="{log}" />-->
<!--<Controls id="controls" v-bind="{...controls, transmission: truck.transmission}" />-->
</main>
</template>

<script>
Expand Down Expand Up @@ -100,48 +100,43 @@ export default {
}, 9000);*/
},
methods: {
methods: {
currentSkinComponent() {
const currentSkin = this.currentSkin; //this.$store.getters[ 'skins/current' ];
//console.log( this.currentSkin );
const currentSkin = this.$store.getters[ 'skins/current' ];
if ( currentSkin === undefined || currentSkin === null )
return null;
if ( currentSkin === undefined || currentSkin === null )
return null;
return 'Dash' + currentSkin.id;
},
/*telemetryData() {
return this.pickData()( DATA_ELEMENTS.game );
},*/
...mapGetters( {
//pickData: 'telemetry/pick',
menuIsDisplayed: 'menu/isDisplayed'
} )
},
computed: {
gameConnected() {
const gameReady = this.telemetry.game !== null &&
(typeof this.telemetry.game
=== 'object'
&& Object.keys( this.telemetry.game ).length
> 0);
//console.log( 'Game', this.telemetry.game, gameReady );
return gameReady && this.telemetry.game.sdkActive;
}
return 'Dash' + currentSkin.id;
}
},
sockets: {
connect: function () {
console.log( 'connected' );
this.launching = {
icon: '<i class="fas fa-truck"></i>',
text: 'Connected to telemetry server',
subText: 'Ready to delivering'
};
},
update: function ( data ) {
computed: {
gameConnected() {
const gameReady = this.telemetry.game !== null &&
(typeof this.telemetry.game
=== 'object'
&& Object.keys( this.telemetry.game ).length
> 0);
//console.log( 'Game', this.telemetry.game, gameReady );
return gameReady && this.telemetry.game.sdkActive;
},
...mapGetters( {
menuIsDisplayed: 'menu/isDisplayed',
currentSkin: 'skins/current'
} )
},
sockets: {
connect: function () {
console.log( 'connected' );
this.launching = {
icon: '<i class="fas fa-truck"></i>',
text: 'Connected to telemetry server',
subText: 'Ready to delivering'
};
},
update: function ( data ) {
let srvData = {};
for ( const key of Object.keys( data ) ) {
Expand Down
34 changes: 16 additions & 18 deletions src/components/Elements/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,22 @@
import AppDashMixins from '../Mixins/AppDashMixins';
export default {
name: 'Dashboard',
mixins: [ AppDashMixins ],
methods: {
enabledFullScreen() {
return process.env.VUE_APP_ENABLE_FULLSCREEN === 'true';
},
/*telemetryData() {
return this.pickData()();
},*/
skinData() {
return this.currentSkin();
},
...mapGetters( {
//pickData: 'telemetry/pick',
currentSkin: 'skins/current'
} )
}
};
name: 'Dashboard',
mixins: [ AppDashMixins ],
methods: {
enabledFullScreen() {
return process.env.VUE_APP_ENABLE_FULLSCREEN === 'true';
},
skinData() {
return this.currentSkin;
}
},
computed: {
...mapGetters( {
currentSkin: 'skins/current'
} )
}
};
</script>

<style lang="scss" scoped>
Expand Down
Loading

0 comments on commit 08720e8

Please sign in to comment.