Giter VIP home page Giter VIP logo

electron-better-web-request's People

Contributors

hugomano avatar nacryn avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

electron-better-web-request's Issues

refacto: prefer array#includes over switch case

hasCallback(method: WebRequestMethod): boolean {

class BetterWebRequest {
  ...
  hasCallback(method: WebRequestMethod): boolean {
    switch (method) {
      case 'onBeforeRequest':
      case 'onBeforeSendHeaders':
      case 'onHeadersReceived':
        return true;
      default:
        return false;
    }
  }
   ...
}

prefer

const methodsWithCallback = [
  'onBeforeRequest',
  'onBeforeSendHeaders',
  'onHeadersReceived',
]

class BetterWebRequest {
  ...
  hasCallback(method: WebRequestMethod): boolean {
    return methodsWithCallback.includes(method);
  }
 ...
}

#1

Get request properties (post data) in onCompleted event

Hi,

Not technically an issue but a small question if any of the devs could help.

Do you think we can get the request properties including the post data in the onCompleted event?

Only the response properties seem to be available.

Only one callback gets called

It appears that when for example using multiple onBeforeRequest events, only the last one gets executed.

webRequest.onBeforeRequest(
    { urls: ['<all_urls>'] },
    async (details: Electron.OnBeforeRequestDetails, callback: any) => {
      console.log('test1');
      callback({ cancel: false });
    },
);

webRequest.onBeforeRequest(
    { urls: ['<all_urls>'] },
    async (details: Electron.OnBeforeRequestDetails, callback: any) => {
      console.log('test2');
      callback({ cancel: false });
    },
);

Prints: test2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.