3 mw.hook( 'postEdit' ).add( () => {
4 // Only continue to delete the data if the data-saved flag hasn't been set in ./edit.js
5 if ( !mw.storage.session.get( 'EditRecovery-data-saved' ) ) {
8 const storage = require( './storage.js' );
9 storage.openDatabase().then( () => {
10 const pageName = mw.config.get( 'wgPageName' );
11 const section = mw.storage.session.get( pageName + '-editRecoverySection' ) || null;
12 // Delete the sessionStorage items
13 mw.storage.session.remove( pageName + '-editRecoverySection' );
14 mw.storage.session.remove( 'EditRecovery-data-saved' );
15 storage.deleteData( pageName, section );
16 storage.closeDatabase();