segment-boneyard/nightmare

feature: add nightmare.cookies.flush()

Open

#1395 aperta il 28 feb 2018

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)JavaScript (1076 fork)batch import
3.xFeature RequestHelp Wanted

Metriche repository

Star
 (19.507 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Based on our discussion in #1296, it'd be good to support: await nightmare.cookies.flush().

That would involve adding the action to action.js along with some tests. Here's the custom action it would be based on:

// try to flush the session data
function CookieFlusher(Nightmare) {
  Nightmare.action(
    'flushCookies',
    (name, options, parent, win, renderer, done) => {
      parent.respondTo('flushCookies', done => {
        win.webContents.session.cookies.flushStore(done)
      })
      done()
    },
    function(done) {
      this.child.call('flushCookies', done)
    }
  )
}

Guida contributor