Merge pull request #8300 from smayes5/intro.js-v2.0

Updates to Intro.js Definition and Tests
This commit is contained in:
Masahiro Wakame
2016-02-29 22:36:35 +09:00
2 changed files with 42 additions and 7 deletions
+27 -3
View File
@@ -1,6 +1,8 @@
/// <reference path="intro.js.d.ts" />
var intro = introJs();
var introWithElement = introJs(document.body);
var introWithQuerySelector = introJs('body');
intro.setOption('doneLabel', 'Next page');
intro.setOption('overlayOpacity', 50);
@@ -48,9 +50,31 @@ intro.start()
.onafterchange(function (element) {
element.getAttribute('class');
})
.onchange(function () {
alert('Changed');
.onchange(function (element) {
element.getAttribute('class');
})
.oncomplete(function () {
alert('Done');
});
})
.onexit(function () {
alert('Exiting');
})
.onhintsadded(function () {
alert('Hints added');
})
.onhintclick(function (hintElement, item, stepId) {
hintElement.getAttribute('class');
})
.onhintclose(function (stepId) {
alert('Hint close for Step ID ' + stepId);
})
.addHints()
.clone();
introWithElement.start()
.exit()
.clone();
introWithQuerySelector.start()
.exit()
.clone();
+15 -4
View File
@@ -1,4 +1,4 @@
// Type definitions for intro.js 1.1.1
// Type definitions for intro.js 2.0
// Project: https://github.com/usablica/intro.js
// Definitions by: Maxime Fabre <https://github.com/anahkiasen/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -29,12 +29,15 @@ declare module IntroJs {
overlayOpacity?: number;
positionPrecedence?: string[];
disableInteraction?: boolean;
steps: Step[];
hintPosition?: string;
hintButtonLabel?: string;
steps?: Step[];
}
interface IntroJs {
start(): IntroJs;
exit(): IntroJs;
clone(): IntroJs;
goToStep(step: number): IntroJs;
nextStep(): IntroJs;
@@ -48,12 +51,20 @@ declare module IntroJs {
onexit(callback: Function): IntroJs;
onbeforechange(callback: (element: HTMLElement) => any): IntroJs;
onafterchange(callback: (element: HTMLElement) => any): IntroJs;
onchange(callback: Function): IntroJs;
onchange(callback: (element: HTMLElement) => any): IntroJs;
oncomplete(callback: Function): IntroJs;
addHints(): IntroJs;
onhintsadded(callback: Function): IntroJs;
onhintclick(callback: (hintElement: HTMLElement, item: Step, stepId: number) => any): IntroJs;
onhintclose(callback: (stepId: number) => any): IntroJs;
}
interface Factory {
(element?: string): IntroJs;
(): IntroJs;
(element: HTMLElement): IntroJs;
(querySelector: string): IntroJs;
}
}