Skip to content

Commit cbfa195

Browse files
authored
Merge branch 'master' into CB-7179
2 parents 52e3534 + a0c267f commit cbfa195

File tree

2 files changed

+60
-186
lines changed

2 files changed

+60
-186
lines changed

.travis.yml

Lines changed: 35 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ matrix:
1919
os: linux
2020
language: node_js
2121
node_js: '4.2'
22-
# TBD SKIP for now:
23-
# - env: PLATFORM=browser-safari
24-
# os: linux
25-
# language: node_js
26-
# node_js: '4.2'
22+
- env: PLATFORM=browser-safari
23+
os: linux
24+
language: node_js
25+
node_js: '4.2'
2726
- env: PLATFORM=browser-edge
2827
os: linux
2928
language: node_js
@@ -38,9 +37,6 @@ matrix:
3837
osx_image: xcode8.3
3938
language: node_js
4039
node_js: '4.2'
41-
# FUTURE TBD:
42-
# - env: PLATFORM=ios-11.4
43-
# ...
4440
- env: PLATFORM=android-4.4
4541
os: linux
4642
language: android
@@ -51,40 +47,36 @@ matrix:
5147
- platform-tools
5248
- tools
5349
- build-tools-26.0.2
54-
# TBD SKIP for now:
55-
# - env: PLATFORM=android-5.1
56-
# os: linux
57-
# language: android
58-
# jdk: oraclejdk8
59-
# android:
60-
# components:
61-
# - tools
62-
# - platform-tools
63-
# - tools
64-
# - build-tools-26.0.2
65-
# - env: PLATFORM=android-6.0
66-
# os: linux
67-
# language: android
68-
# jdk: oraclejdk8
69-
# android:
70-
# components:
71-
# - tools
72-
# - platform-tools
73-
# - tools
74-
# - build-tools-26.0.2
75-
# - env: PLATFORM=android-7.0
76-
# os: linux
77-
# language: android
78-
# jdk: oraclejdk8
79-
# android:
80-
# components:
81-
# - tools
82-
# - platform-tools
83-
# - tools
84-
# - build-tools-26.0.2
85-
# FUTURE TBD:
86-
# - env: PLATFORM=android-8.?
87-
# ...
50+
- env: PLATFORM=android-5.1
51+
os: linux
52+
language: android
53+
jdk: oraclejdk8
54+
android:
55+
components:
56+
- tools
57+
- platform-tools
58+
- tools
59+
- build-tools-26.0.2
60+
- env: PLATFORM=android-6.0
61+
os: linux
62+
language: android
63+
jdk: oraclejdk8
64+
android:
65+
components:
66+
- tools
67+
- platform-tools
68+
- tools
69+
- build-tools-26.0.2
70+
- env: PLATFORM=android-7.0
71+
os: linux
72+
language: android
73+
jdk: oraclejdk8
74+
android:
75+
components:
76+
- tools
77+
- platform-tools
78+
- tools
79+
- build-tools-26.0.2
8880

8981
before_install:
9082
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm
@@ -93,7 +85,7 @@ before_install:
9385
- node --version
9486
- if [[ "$PLATFORM" =~ android ]]; then gradle --version; fi
9587
- if [[ "$PLATFORM" =~ ios ]]; then npm install -g ios-deploy; fi
96-
- if [[ "$PLATFORM" =~ android ]]; then echo y | android update sdk -u --filter android-22,android-23,android-24,android-25,android-26;
88+
- if [[ "$PLATFORM" =~ android ]]; then echo y | android update sdk -u --filter android-22,android-23,android-24,android-25,android-26,android-27;
9789
fi
9890
- git clone https://github.com/apache/cordova-paramedic /tmp/paramedic && pushd /tmp/paramedic
9991
&& npm install && popd

types/index.d.ts

Lines changed: 25 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,13 @@
22
// Project: https://github.com/apache/cordova-plugin-inappbrowser
33
// Definitions by: Microsoft Open Technologies Inc <http://msopentech.com>
44
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5-
//
5+
//
66
// Copyright (c) Microsoft Open Technologies Inc
77
// Licensed under the MIT license.
8+
// TypeScript Version: 2.3
9+
type channel = "loadstart" | "loadstop" | "loaderror" | "exit";
810

911
interface Window {
10-
/**
11-
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
12-
* @param url The URL to load.
13-
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
14-
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
15-
* The options string must not contain any blank space, and each feature's
16-
* name/value pairs must be separated by a comma. Feature names are case insensitive.
17-
*/
18-
open(url: string, target?: "_self", options?: string): InAppBrowser;
19-
/**
20-
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
21-
* @param url The URL to load.
22-
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
23-
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
24-
* The options string must not contain any blank space, and each feature's
25-
* name/value pairs must be separated by a comma. Feature names are case insensitive.
26-
*/
27-
open(url: string, target?: "_blank", options?: string): InAppBrowser;
28-
/**
29-
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
30-
* @param url The URL to load.
31-
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
32-
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
33-
* The options string must not contain any blank space, and each feature's
34-
* name/value pairs must be separated by a comma. Feature names are case insensitive.
35-
*/
36-
open(url: string, target?: "_system", options?: string): InAppBrowser;
3712
/**
3813
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
3914
* @param url The URL to load.
@@ -50,66 +25,21 @@ interface Window {
5025
* NOTE: The InAppBrowser window behaves like a standard web browser, and can't access Cordova APIs.
5126
*/
5227
interface InAppBrowser extends Window {
53-
onloadstart: (type: InAppBrowserEvent) => void;
54-
onloadstop: (type: InAppBrowserEvent) => void;
55-
onloaderror: (type: InAppBrowserEvent) => void;
56-
onexit: (type: InAppBrowserEvent) => void;
28+
onloadstart(type: Event): void;
29+
onloadstop(type: InAppBrowserEvent): void;
30+
onloaderror(type: InAppBrowserEvent): void;
31+
onexit(type: InAppBrowserEvent): void;
5732
// addEventListener overloads
5833
/**
5934
* Adds a listener for an event from the InAppBrowser.
60-
* @param type the event to listen for
61-
* loadstart: event fires when the InAppBrowser starts to load a URL.
62-
* loadstop: event fires when the InAppBrowser finishes loading a URL.
63-
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
64-
* exit: event fires when the InAppBrowser window is closed.
65-
* @param callback the function that executes when the event fires. The function is
66-
* passed an InAppBrowserEvent object as a parameter.
67-
*/
68-
addEventListener(type: "loadstart", callback: (event: InAppBrowserEvent) => void): void;
69-
/**
70-
* Adds a listener for an event from the InAppBrowser.
71-
* @param type the event to listen for
72-
* loadstart: event fires when the InAppBrowser starts to load a URL.
73-
* loadstop: event fires when the InAppBrowser finishes loading a URL.
74-
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
75-
* exit: event fires when the InAppBrowser window is closed.
76-
* @param callback the function that executes when the event fires. The function is
77-
* passed an InAppBrowserEvent object as a parameter.
78-
*/
79-
addEventListener(type: "loadstop", callback: (event: InAppBrowserEvent) => void): void;
80-
/**
81-
* Adds a listener for an event from the InAppBrowser.
82-
* @param type the event to listen for
83-
* loadstart: event fires when the InAppBrowser starts to load a URL.
84-
* loadstop: event fires when the InAppBrowser finishes loading a URL.
85-
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
86-
* exit: event fires when the InAppBrowser window is closed.
87-
* @param callback the function that executes when the event fires. The function is
88-
* passed an InAppBrowserEvent object as a parameter.
89-
*/
90-
addEventListener(type: "loaderror", callback: (event: InAppBrowserEvent) => void): void;
91-
/**
92-
* Adds a listener for an event from the InAppBrowser.
93-
* @param type the event to listen for
94-
* loadstart: event fires when the InAppBrowser starts to load a URL.
35+
* @param type loadstart: event fires when the InAppBrowser starts to load a URL.
9536
* loadstop: event fires when the InAppBrowser finishes loading a URL.
9637
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
9738
* exit: event fires when the InAppBrowser window is closed.
9839
* @param callback the function that executes when the event fires. The function is
9940
* passed an InAppBrowserEvent object as a parameter.
10041
*/
101-
addEventListener(type: "exit", callback: (event: InAppBrowserEvent) => void): void;
102-
/**
103-
* Adds a listener for an event from the InAppBrowser.
104-
* @param type the event to listen for
105-
* loadstart: event fires when the InAppBrowser starts to load a URL.
106-
* loadstop: event fires when the InAppBrowser finishes loading a URL.
107-
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
108-
* exit: event fires when the InAppBrowser window is closed.
109-
* @param callback the function that executes when the event fires. The function is
110-
* passed an Event object as a parameter.
111-
*/
112-
addEventListener(type: string, callback: (event: Event) => void): void;
42+
addEventListener(type: channel, callback: InAppBrowserEventListenerOrEventListenerObject): void;
11343
// removeEventListener overloads
11444
/**
11545
* Removes a listener for an event from the InAppBrowser.
@@ -121,51 +51,7 @@ interface InAppBrowser extends Window {
12151
* @param callback the function that executes when the event fires. The function is
12252
* passed an InAppBrowserEvent object as a parameter.
12353
*/
124-
removeEventListener(type: "loadstart", callback: (event: InAppBrowserEvent) => void): void;
125-
/**
126-
* Removes a listener for an event from the InAppBrowser.
127-
* @param type The event to stop listening for.
128-
* loadstart: event fires when the InAppBrowser starts to load a URL.
129-
* loadstop: event fires when the InAppBrowser finishes loading a URL.
130-
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
131-
* exit: event fires when the InAppBrowser window is closed.
132-
* @param callback the function that executes when the event fires. The function is
133-
* passed an InAppBrowserEvent object as a parameter.
134-
*/
135-
removeEventListener(type: "loadstop", callback: (event: InAppBrowserEvent) => void): void;
136-
/**
137-
* Removes a listener for an event from the InAppBrowser.
138-
* @param type The event to stop listening for.
139-
* loadstart: event fires when the InAppBrowser starts to load a URL.
140-
* loadstop: event fires when the InAppBrowser finishes loading a URL.
141-
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
142-
* exit: event fires when the InAppBrowser window is closed.
143-
* @param callback the function that executes when the event fires. The function is
144-
* passed an InAppBrowserEvent object as a parameter.
145-
*/
146-
removeEventListener(type: "loaderror", callback: (event: InAppBrowserEvent) => void): void;
147-
/**
148-
* Removes a listener for an event from the InAppBrowser.
149-
* @param type The event to stop listening for.
150-
* loadstart: event fires when the InAppBrowser starts to load a URL.
151-
* loadstop: event fires when the InAppBrowser finishes loading a URL.
152-
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
153-
* exit: event fires when the InAppBrowser window is closed.
154-
* @param callback the function that executes when the event fires. The function is
155-
* passed an InAppBrowserEvent object as a parameter.
156-
*/
157-
removeEventListener(type: "exit", callback: (event: InAppBrowserEvent) => void): void;
158-
/**
159-
* Removes a listener for an event from the InAppBrowser.
160-
* @param type The event to stop listening for.
161-
* loadstart: event fires when the InAppBrowser starts to load a URL.
162-
* loadstop: event fires when the InAppBrowser finishes loading a URL.
163-
* loaderror: event fires when the InAppBrowser encounters an error when loading a URL.
164-
* exit: event fires when the InAppBrowser window is closed.
165-
* @param callback the function that executes when the event fires. The function is
166-
* passed an Event object as a parameter.
167-
*/
168-
removeEventListener(type: string, callback: (event: Event) => void): void;
54+
removeEventListener(type: channel, callback: InAppBrowserEventListenerOrEventListenerObject): void;
16955
/** Closes the InAppBrowser window. */
17056
close(): void;
17157
/** Hides the InAppBrowser window. Calling this has no effect if the InAppBrowser was already hidden. */
@@ -184,29 +70,21 @@ interface InAppBrowser extends Window {
18470
* For multi-line scripts, this is the return value of the last statement,
18571
* or the last expression evaluated.
18672
*/
187-
executeScript(script: { code: string }, callback: (result: any) => void): void;
188-
/**
189-
* Injects JavaScript code into the InAppBrowser window.
190-
* @param script Details of the script to run, specifying either a file or code key.
191-
* @param callback The function that executes after the JavaScript code is injected.
192-
* If the injected script is of type code, the callback executes with
193-
* a single parameter, which is the return value of the script, wrapped in an Array.
194-
* For multi-line scripts, this is the return value of the last statement,
195-
* or the last expression evaluated.
196-
*/
197-
executeScript(script: { file: string }, callback: (result: any) => void): void;
198-
/**
199-
* Injects CSS into the InAppBrowser window.
200-
* @param css Details of the script to run, specifying either a file or code key.
201-
* @param callback The function that executes after the CSS is injected.
202-
*/
203-
insertCSS(css: { code: string }, callback: () => void): void;
73+
executeScript(script: { code: string } | { file: string }, callback: (result: any) => void): void;
20474
/**
20575
* Injects CSS into the InAppBrowser window.
20676
* @param css Details of the script to run, specifying either a file or code key.
20777
* @param callback The function that executes after the CSS is injected.
20878
*/
209-
insertCSS(css: { file: string }, callback: () => void): void;
79+
insertCSS(css: { code: string } | { file: string }, callback: () => void): void;
80+
}
81+
82+
type InAppBrowserEventListenerOrEventListenerObject = InAppBrowserEventListener | InAppBrowserEventListenerObject;
83+
84+
type InAppBrowserEventListener = (evt: InAppBrowserEvent) => void;
85+
86+
interface InAppBrowserEventListenerObject {
87+
handleEvent(evt: InAppBrowserEvent): void;
21088
}
21189

21290
interface InAppBrowserEvent extends Event {
@@ -218,4 +96,8 @@ interface InAppBrowserEvent extends Event {
21896
code: number;
21997
/** the error message, only in the case of loaderror. */
22098
message: string;
221-
}
99+
}
100+
101+
interface Cordova {
102+
InAppBrowser: InAppBrowser;
103+
}

0 commit comments

Comments
 (0)