good-goodbye

0.0.10 • Public • Published

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.

Package Sidebar

Install

npm i good-goodbye

Weekly Downloads

0

Version

0.0.10

License

MIT

Unpacked Size

27 kB

Total Files

12

Last publish

Collaborators

  • spaceless23