How detect window closed (new tab) in Vue?

28
May 18, 2019, at 2:40 PM

Need watch if that window open or closed... It working when use SetInterval and close window early but, how detect when it realy closed without SetInterval and fire it...

<template>
<button class="btn btn-info" @click="OpenTask('http://google.com')">Open window</button>
</template>
<script>
export default {
        data() {
            return {
                window: null,
                task:[],
            }
        },
        mounted() {
        },
        beforeDestroy() {
        },
        watch: {
        },
        methods: {
            OpenTask(url){
                var that = this;
                Vue.prototype.surf = window.open(url,'_blank');
                this.window = this.surf.closed;
                setInterval(function e () {
                    console.log(that.surf.closed);
                }, 7000);
                if(that.surf.closed)){
                console.log(that.surf.closed);
                this.window = this.surf.closed;
                }}
            },
        }
    }
    </script>

It actully not detecting when window is closed... how make it?

READ ALSO
How to animate circular progress bar on page scroll down

How to animate circular progress bar on page scroll down

I have a circular progress bar that animates when the page loads, but I want it to animate when the user scrolls down to it, as it will be in the middle of the pageRight now if the page loads, the user does not see the animation

28
Adding a Popup box for Winner of Game

Adding a Popup box for Winner of Game

I have been trying to add a popup box for my rock paper scissors game so that the program will display the winner when the game is overI have a function file and a file with the main code

73
Can I map a function with more then one argument?

Can I map a function with more then one argument?

In EE (Google Earth Engine Javascript API) I can do

45
import array of objects with a module as a property returns undefined when import twice

import array of objects with a module as a property returns undefined when import twice

I'm trying to import an array of objects that has a module as a propertyThe first file that imports the object has no problem, but the second one has undefined

56