README
Headway SDK
Disclaimer
Videsk is not proprietary of Headwayapp.co, and not have any business direct relation with Headway App, Inc. This SDK was developed because Videsk need integrate Headway app in custom UI, more programmatically and flexible.
Headway App, Inc. can decide to make this code public, transfer to them or delete it.
Please take as real needs of a customer, not intent of break copyrights.
Installation
npm i @videsk/headway-sdk
How to use
const account = 'XXXXX';
const changelog = new HeadwaySDK(account);
changelog.on('height', height => {
// Set height to the iframe or parent node that contain the iframe
});
changelog.on('ready', (changelogs) => {
// Do something if you want or with changelogs
// The changelogs is an array
});
const element = document.querySelector('body');
changelog.render(element);
Events
The SDK provide a list of events. Events can be set by property event
or method on
, after instance the class.
property
changelog.events.ready = function () {
// Do something
};
changelog.events.badge = function () {
// Do something
};
method
changelog.on('ready', function () {
// Do something
});
changelog.on('badge', function () {
// Do something
});
Ready
Ready event is emitted when the widget (iframe) was loaded successfully. Returns the changelogs as argument.
changelog.on('ready', function (changelogs) {
// Do something
});
Badge
Badge event is emitted to set the number of changelogs has not been seen. Returns the number of changelog as argument.
changelog.on('badge', function (number) {
// Set badge on your DOM node
})
Height
Height event is emitted to set the height of iframe or parent node in pixels. This is based on height of website iframe to avoid showing an overflow.
This event can consider as optional to listen, because if you don't listen an overflow will display on iframe.
changelog.on('height', function (height) {
// Apply height to custom node.
iframe.style.height = height + 'px'; // Example
iframeContainer.style.height = height + 'px'; // Example
});
Copyrights
This SDK was develop by Videsk, but the real proprietary is Headway App, Inc., and is mandated to decide to eliminate or unpublished this code.