js/dialogue.js
function closeInstance(dialogue) {

  // none may be open yet, or one may be open but may be closing another which is not open
  if (typeof dialogue === 'undefined' || typeof dialogue.options === 'undefined' || !dialoguesOpen.length) {
    return;
  }

  dialoguesOpen.forEach(function(dialogueSingle, index) {
    if (dialogueSingle.options.id == dialogue.options.id) {
      dialoguesOpen.splice(index, 1);
    }
  });

  if (!dialoguesOpen.length) {
    document.removeEventListener('keyup', handleKeyup);
    document.removeEventListener('mousedown', handleMousedown);
  }

  // .off('click.dialogue.action')

  // dialogue.container.off(); // needed?
  docBody.removeChild(dialogue.container);
  dialogue.options.onClose.call(dialogue);
}
function closeInstance(dialogue) {

  // none may be open yet, or one may be open but may be closing another which is not open
  if (typeof dialogue === 'undefined' || typeof dialogue.options === 'undefined' || !dialoguesOpen.length) {
    return;
  }

  dialoguesOpen.forEach(function(dialogueSingle, index) {
    if (dialogueSingle.options.id == dialogue.options.id) {
      dialoguesOpen.splice(index, 1);
    }
  });

  if (!dialoguesOpen.length) {
    document.removeEventListener('keyup', handleKeyup);
    document.removeEventListener('mousedown', handleMousedown);
  }

  // .off('click.dialogue.action')

  // dialogue.container.off(); // needed?
  docBody.removeChild(dialogue.container);
  dialogue.options.onClose.call(dialogue);
}
function closeInstance ( dialogue ) { // none may be open yet, or one may be open but may be closing another which is not open if ( typeof dialogue === 'undefined' || typeof dialogue . options === 'undefined' || ! dialoguesOpen . length ) { return ; } dialoguesOpen . forEach ( function ( dialogueSingle , index ) { if ( dialogueSingle . options . id == dialogue . options . id ) { dialoguesOpen . splice ( index , 1 ) ; } } ) ; if ( ! dialoguesOpen . length ) { document . removeEventListener ( 'keyup' , handleKeyup ) ; document . removeEventListener ( 'mousedown' , handleMousedown ) ; } // .off('click.dialogue.action') // dialogue.container.off(); // needed? docBody . removeChild ( dialogue . container ) ; dialogue . options . onClose . call ( dialogue ) ; }
call onclose and remove
@param  {object} data
@return {null}
call onclose and remove