0.2.0 • Published 6 years ago

electron-ad-blocker v0.2.0

Weekly downloads
6
License
MPL
Repository
github
Last release
6 years ago

Electron ad blocker

Blocks advertisements in an electron browser window.

Build from source

Because this module contains native modules, it should build from source for the correct version of node of your electron distribution (and not the default one on your machine). If you know how to do this, you can skip this. If not, I wrote a short tutorial for you.

Getting Started

$ yarn add electron-ad-blocker
const { BrowserWindow } = require('electron');
const { blockWindowAds, adBlocker } = require('electron-ad-blocker');

const options = {
  verbose: true,
  logger: console,
};

const mainWindow = new BrowserWindow({ width: 800, height: 600 });
blockWindowAds(mainWindow, options);

// You can also blacklist other websites, since adBlocker is the
// client instance of the contains-ads module.
adBlocker.parse('||blacklistwebsite.com')

Possible options

logger (console): A custom logger instance to use.
verbose (false): Whether or not the ad blocker should log when he blocks a request.
onRequest (undefined): Gets called like the original onRequest of a BrowserWindow instance.

blockWindowAds(browserWindow, {
  verbose: true,
  logger: console,
  onRequest: (details, callback, shouldBeBlocked) => {
    // Execute your own onRequest function here...
  },
});
0.2.0

6 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago