correct some tslint warnings

This commit is contained in:
nedunk
2017-03-28 09:27:42 +02:00
parent 444d3d0276
commit 5caf358c8d
2 changed files with 15 additions and 15 deletions
+3 -3
View File
@@ -112,14 +112,14 @@ interface IWebPage {
// evaluate<T1, T2, T3, R>(callback: (arg1: T1, arg2: T2, arg3: T3) => R, arg1: T1, arg2: T2, arg3: T3): Promise<R>;
// evaluate<R>(callback: (...args: any[]) => R, ...args: any[]): Promise<R>;
evaluate<R>(callback: () => R, ...args: any[]): R;
evaluateAsync(fn: Function): void;
evaluateAsync(fn: () => void): void;
evaluateJavaScript(str: string): any; // :TODO: elaborate this when documentation improves
getPage(windowName: string): IWebPage;
go(index: number): void;
goBack(): void;
goForward(): void;
includeJs(url: string): Promise<void>;
includeJs(url: string, callback: Function): void;
includeJs(url: string, callback: () => void): void;
injectJs(filename: string): Promise<boolean>;
injectJs(filename: string): boolean;
open(url: string): Promise<string>;
@@ -153,7 +153,7 @@ interface IWebPage {
// Callbacks
onAlert: (msg: string) => any;
onCallback: Function; // EXPERIMENTAL
onCallback: () => void; // EXPERIMENTAL
onClosing: (closingPage: IWebPage) => any;
onConfirm: (msg: string) => boolean;
onConsoleMessage: (msg: string, lineNum?: number, sourceId?: string) => any;
+12 -12
View File
@@ -5,18 +5,18 @@ let vUrl = 'https://www.w3c.org';
let vUserAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8'
page.settings.userAgent = vUserAgent;
page.onConsoleMessage = function(vMsg) {
page.onConsoleMessage = (vMsg) => {
};
page.onAlert = function(vMsg) {
page.onAlert = (vMsg) => {
};
page.onLoadStarted = function() {
page.onLoadStarted = () => {
};
page.captureContent = [ /json/ ]
page.onResourceReceived = function(oResponse) {
page.onResourceReceived = (oResponse) => {
oResponse.id;
oResponse.bodySize;
oResponse.body;
@@ -24,7 +24,7 @@ page.onResourceReceived = function(oResponse) {
oResponse.headers;
};
page.onResourceRequested = function(oRequestData, oNetworkRequest) {
page.onResourceRequested = (oRequestData, oNetworkRequest) => {
oRequestData.headers;
oRequestData.id;
oRequestData.method;
@@ -33,31 +33,31 @@ page.onResourceRequested = function(oRequestData, oNetworkRequest) {
};
page.onLoadFinished = function(vStatus) {
page.onLoadFinished = (vStatus) => {
phantom.exit();
};
page.onInitialized = function() {
page.onInitialized = () => {
};
page.onPageCreated = function(oPage) {
page.onPageCreated = (oPage) => {
let oCookie: ICookie
oPage.addCookie(oCookie);
};
page.open(vUrl) // loads a page
.then(function(){ // executed after loading
page.viewportSize = { width:414, height:736 };
.then(() => { // executed after loading
page.viewportSize = { width: 414, height: 736 };
let vFilename = `../data/page01.png`;
page.render(vFilename, {onlyViewport:true})
page.render(vFilename, {onlyViewport: true})
// then open a second page
return page.open('http://');
})
.then(function(){
.then(() => {
// click somewhere on the second page
page.sendEvent("click", 5, 5, 'left', 0);
slimer.exit()