2.2.0 • Published 5 years ago

oath-viewability v2.2.0

Weekly downloads
1
License
Apache-2.0
Repository
-
Last release
5 years ago

oath-viewability

Oath viewability detection plugin

Screwdriver Pipeline

https://screwdriver.ouroath.com/pipelines/1008183/events

Install

npm install --save oath-viewability

Usage

ECMA6+ style

import oathViewabilityLoader from 'oath-viewability'

const someDOMElement = document.getElementById('my-element')
oathViewabilityLoader.then((oathViewability) => {
    const elementViewability = new oathViewability(someDOMElement)
    elementViewability.then((detector) => {
        detector.getPercent() // {0-100}
        detector.getVisible() // {0|1}
    })    
})

Common JS Style

Embed the script from ./node_modules/oath-viewability/dist/clj.js

(function(window) {
    var someDOMElement = document.getElementById('my-element');
    
    window.oath.viewability.then(function(oathViewability) {
        var elementViewability = new oathViewability(someDOMElement)
        elementViewability.then(function(detector) {
            detector.getPercent(); // {0-100}
            detector.getVisible(); // {0|1}
        })  
    });
})(window);

Local usage

You can use npm start if you want to check demopage on http://localhost:8080/demo/

2.2.0

5 years ago

2.1.0

5 years ago

2.0.0

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago