Skip to content

Commit

Permalink
screen wake lock
Browse files Browse the repository at this point in the history
  • Loading branch information
vabene1111 committed Jan 29, 2025
1 parent f5837fd commit fcbc4cb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion vue3/src/components/display/RecipeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<script setup lang="ts">
import {computed, ref, watch} from 'vue'
import {computed, onBeforeUnmount, onMounted, ref, watch} from 'vue'
import {Recipe} from "@/openapi"
import NumberScalerDialog from "@/components/inputs/NumberScalerDialog.vue"
import StepsOverview from "@/components/display/StepsOverview.vue";
Expand All @@ -88,6 +88,9 @@ import RecipeContextMenu from "@/components/inputs/RecipeContextMenu.vue";
import KeywordsComponent from "@/components/display/KeywordsBar.vue";
import RecipeImage from "@/components/display/RecipeImage.vue";
import ExternalRecipeViewer from "@/components/display/ExternalRecipeViewer.vue";
import {useWakeLock} from "@vueuse/core";
const {request, release} = useWakeLock()
const recipe = defineModel<Recipe>({required: true})
Expand All @@ -104,6 +107,16 @@ watch(() => recipe.value.servings, () => {
}
})
onMounted(() => {
//keep screen on while viewing a recipe
request("screen")
})
onBeforeUnmount(() => {
// allow screen to turn off after leaving the recipe page
release()
})
</script>

<style scoped>
Expand Down

0 comments on commit fcbc4cb

Please sign in to comment.