Skip to content

spaceIess/good_goodbye

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

good_goodbye

Easy way to determine any beforeunload callbacks do you need.

Installation

Install with yarn:

yarn add good-goodbye
# or npm:
npm i -S good-goodbye

Usage

import GooodGoodbye from 'good-goodbye'

GooodGoodbye.set("testUnload", () => { 
  SomeModule.call("unloadCallback")
})

//To show browser prompt return text or true value
GooodGoodbye.set("testUnload", () => { 
  SomeModule.call("unloadCallback")
  if (SomeModule.hasWarnings()) return "Warning"
  if (SomeModule.unfinished()) return true
})

//Get all callbacks
GooodGoodbye.callbacks // => { testUnload: f }

//Unset callback
GooodGoodbye.unset("testUnload")

//Unset all callbacks
GooodGoodbye.unsetAll()

License

Released under MIT License.

Authors

Created by spaceIess.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors