@advertol/core

1.0.4 • Public • Published

@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.

Property Type Description
element HTMLElement Zone DOM element.
id string Zone 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.

Property Type Description
element HTMLElement Zone DOM element.
id string Zone 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ć

Readme

Keywords

Package Sidebar

Install

npm i @advertol/core

Weekly Downloads

724

Version

1.0.4

License

MIT

Unpacked Size

106 kB

Total Files

8

Last publish

Collaborators

  • niksy