Socket
Socket
Sign inDemoInstall

@advertol/core

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @advertol/core

Advertisement zones manager.


Version published
Weekly downloads
486
decreased by-9.16%
Maintainers
1
Install size
104 kB
Created
Weekly downloads
 

Changelog

Source

[1.0.4][] - 2024-02-09

Changed

  • Update check when control should be triggered for specific zone

Readme

Source

@advertol/core

Build Status BrowserStack Status

Core module for creating Advertol instance.

Install

npm install @advertol/core --save

Usage

import advertol from '@advertol/core';
import CustomAdServerService from './service';
import CustomControl from './control';
import CustomContext from './context';

const instance = advertol({
	zones: [{
		id: 'becky',
		element: document.querySelector('.Zone--becky')
	}],
	service: new CustomAdServerService(),
	control: [
		new CustomControl()
	],
	context: [
		new CustomContext()
	]
});

instance.resolve();

API

advertol(options)

Returns: Advertol

Create Advertol instance.

zones

Type: Object[]

List of zones.

PropertyTypeDescription
elementHTMLElementZone DOM element.
idstringZone ID.
service

Type: Service

Advertisement server service.

control

Type: Control[]

List of controls for Advertol instance.

context

Type: Context[]

List of contexts for Advertol instance.

instance.resolve()

Returns: Promise

Resolves current instance state. This should be run first time and every time you add new zone, control or context to resolve new instance state.

instance.addControl(control)

Add new control.

control

Type: 'Control'

instance.addContext(context)

Add new context.

context

Type: 'Context'

instance.addZone({ element, id })

Add new zone.

PropertyTypeDescription
elementHTMLElementZone DOM element.
idstringZone ID.

instance.destroy()

Destroy instance.

Browser support

Tested in IE9+ and all modern browsers, assuming Promise support is available.

Test

For automated tests, run npm run test:automated (append :watch for watcher support).

License

MIT © Ivan Nikolić

Keywords

FAQs

Last updated on 09 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc