Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promised Destruction #175

Open
codewithkyle opened this issue Jun 11, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@codewithkyle
Copy link
Collaborator

commented Jun 11, 2019

The beforeDestroy() method should return a promise that always resolves. By default the beforeDestroy() method should not be defined in any new JavaScript/TypeScript files and the default defined on the base Module class should be:

public beforeDestroy():Promise<unknown>{
    return Promise.resolve();
}

That way when we need to actually do something (such as an animation) we can allow the developer to do what they need to do before resolving the promise, see example below.

beforeDestroy(){
    return new Promise((resolve)=>{
        anime({
            targets: this.view,
            duration: 175,
            easing: Env.EASING.out,
            opacity: [1, 0],
            scale: [1, 0.87],
            complete: ()=>{
                resolve();
            }
        });
    });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.