From 9be408dd560e9358490be7276ed0a555d4b383d9 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Mon, 9 Feb 2015 13:32:33 +0100 Subject: [PATCH 1/5] Remove module in IBAN definition. Add definition for "Java". --- iban/iban.d.ts | 90 ++++++++++++++++++------------------ java/java-tests.ts | 22 +++++++++ java/java-tests.ts.tscparams | 1 + java/java.d.ts | 52 +++++++++++++++++++++ 4 files changed, 119 insertions(+), 46 deletions(-) create mode 100644 java/java-tests.ts create mode 100644 java/java-tests.ts.tscparams create mode 100644 java/java.d.ts diff --git a/iban/iban.d.ts b/iban/iban.d.ts index b39f5908ce..6a7bd803d3 100644 --- a/iban/iban.d.ts +++ b/iban/iban.d.ts @@ -3,58 +3,56 @@ // Definitions by: Cyril Schumacher // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module ARHS { +/** + * @summary Interface for {@link IBAN} object. + * @author Cyril Schumacher + * @version 1.0 + */ +interface IBANStatic { /** - * @summary Interface for {@link IBAN} object. - * @author Cyril Schumacher - * @version 1.0 + * @summary Returns the IBAN in a electronic format. + * @param {string} iban The IBAN to convert. + * @param {string} The IBAN in electronic format. */ - interface IBANStatic { - /** - * @summary Returns the IBAN in a electronic format. - * @param {string} iban The IBAN to convert. - * @param {string} The IBAN in electronic format. - */ - electronicFormat(iban: string): string; + electronicFormat(iban: string): string; - /** - * @summary Convert the passed BBAN to an IBAN for this country specification. - * @param {string} countryCode The country of the BBAN. - * @param {string} bban The BBAN to convert to IBAN. - * @returns {string} The IBAN. - */ - fromBBAN(countryCode: string, bban: string): string; + /** + * @summary Convert the passed BBAN to an IBAN for this country specification. + * @param {string} countryCode The country of the BBAN. + * @param {string} bban The BBAN to convert to IBAN. + * @returns {string} The IBAN. + */ + fromBBAN(countryCode: string, bban: string): string; - /** - * @summary Check if the passed iban is valid according to this specification. - * @param {string} iban The iban to validate. - * @returns {boolean} True if valid, false otherwise. - */ - isValid(iban: string): boolean; + /** + * @summary Check if the passed iban is valid according to this specification. + * @param {string} iban The iban to validate. + * @returns {boolean} True if valid, false otherwise. + */ + isValid(iban: string): boolean; - /** - * @summary Check of the passed BBAN is valid. - * @param {string} countryCode The country of the BBAN. - * @param {string} bban The BBAN to validate. - * @returns {boolean} True if valid, false otherwise. - */ - isValidBBAN(countryCode: string, bban: string): boolean; + /** + * @summary Check of the passed BBAN is valid. + * @param {string} countryCode The country of the BBAN. + * @param {string} bban The BBAN to validate. + * @returns {boolean} True if valid, false otherwise. + */ + isValidBBAN(countryCode: string, bban: string): boolean; - /** - * @summary Returns the IBAN in a print format. - * @param {string} iban The IBAN to convert. - * @param {string} The IBAN in print format. - */ - printFormat(iban: string, separator: string[]): string; + /** + * @summary Returns the IBAN in a print format. + * @param {string} iban The IBAN to convert. + * @param {string} The IBAN in print format. + */ + printFormat(iban: string, separator: string[]): string; - /** - * @summary Convert the passed IBAN to a country-specific BBAN. - * @param {string} iban The IBAN to convert. - * @param {string[]} Separator the separator to use between BBAN blocks. - * @returns {string} The BBAN - */ - toBBAN(iban: string, separator: string[]): string; - } + /** + * @summary Convert the passed IBAN to a country-specific BBAN. + * @param {string} iban The IBAN to convert. + * @param {string[]} Separator the separator to use between BBAN blocks. + * @returns {string} The BBAN + */ + toBBAN(iban: string, separator: string[]): string; } -declare var IBAN: ARHS.IBANStatic; \ No newline at end of file +declare var IBAN: IBANStatic; \ No newline at end of file diff --git a/java/java-tests.ts b/java/java-tests.ts new file mode 100644 index 0000000000..8bbbaea994 --- /dev/null +++ b/java/java-tests.ts @@ -0,0 +1,22 @@ +/// + +/** + * @summary Test for the applet status. + */ +function testStatus() { + var java: Java = { + status: AppletStatus.Loading + }; +} + +/** + * @summary Test for the handlers. + */ +function testHandlers() { + var handler: Function = () => {}; + var java: Java = { + onError: handler, + onLoad: handler, + onStop: handler + }; +} \ No newline at end of file diff --git a/java/java-tests.ts.tscparams b/java/java-tests.ts.tscparams new file mode 100644 index 0000000000..934bc29ef2 --- /dev/null +++ b/java/java-tests.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny \ No newline at end of file diff --git a/java/java.d.ts b/java/java.d.ts new file mode 100644 index 0000000000..a21a77228b --- /dev/null +++ b/java/java.d.ts @@ -0,0 +1,52 @@ +// Type definitions for Java +// Project: https://www.java.com/js/deployJava.txt +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** + * @summary Applet Status. + * {@link http://docs.oracle.com/javase/8/docs/technotes/guides/deploy/applet_dev_guide.html#JSDPG719|Applet Status And Event Handlers} + */ +declare enum AppletStatus { + /** + * @summary Applet is loading. + */ + Loading = 1, + + /** + * @summary Applet has loaded completely and is ready to receive JavaScript calls. + */ + Ready = 2, + + /** + * @summary Error while loading applet. + */ + Error = 3 +} + +/** + * @summary Interface for Java object. + * @author Cyril Schumacher + * @version 1.0 + */ +interface Java { + /** + * Handler if the applet status is ERROR. An error has occurred while loading the applet. + */ + onError?: Function; + + /** + * Handler if the applet status is READY. Applet has finished loading and is ready to receive JavaScript calls. + */ + onLoad?: Function; + + /** + * Handler if the applet has stopped. + */ + onStop?: Function; + + /** + * @summary Applet Status. + */ + status?: AppletStatus; +} \ No newline at end of file From 9cdfa999f555a64c1743f5b33abce73db8fe5a8e Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Mon, 9 Feb 2015 13:35:18 +0100 Subject: [PATCH 2/5] Update header. --- java/java.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/java.d.ts b/java/java.d.ts index a21a77228b..44660aa32b 100644 --- a/java/java.d.ts +++ b/java/java.d.ts @@ -1,5 +1,5 @@ // Type definitions for Java -// Project: https://www.java.com/js/deployJava.txt +// Project: https://www.java.com/ // Definitions by: Cyril Schumacher // Definitions: https://github.com/borisyankov/DefinitelyTyped From b63fcec22ae000d7d9f6240d832702b3be9566ea Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Mon, 9 Feb 2015 15:49:23 +0100 Subject: [PATCH 3/5] Rename the directory "java" to "java-applet". --- {java => java-applet}/java-tests.ts | 0 {java => java-applet}/java-tests.ts.tscparams | 0 {java => java-applet}/java.d.ts | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename {java => java-applet}/java-tests.ts (100%) rename {java => java-applet}/java-tests.ts.tscparams (100%) rename {java => java-applet}/java.d.ts (100%) diff --git a/java/java-tests.ts b/java-applet/java-tests.ts similarity index 100% rename from java/java-tests.ts rename to java-applet/java-tests.ts diff --git a/java/java-tests.ts.tscparams b/java-applet/java-tests.ts.tscparams similarity index 100% rename from java/java-tests.ts.tscparams rename to java-applet/java-tests.ts.tscparams diff --git a/java/java.d.ts b/java-applet/java.d.ts similarity index 100% rename from java/java.d.ts rename to java-applet/java.d.ts From 2c67795a50df65814ea7aa07d6f88684fc24e541 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Mon, 9 Feb 2015 15:52:48 +0100 Subject: [PATCH 4/5] Rename files "java*.*" to "java-applet*.*". --- java-applet/{java-tests.ts => java-applet-tests.ts} | 4 ++-- ...java-tests.ts.tscparams => java-applet-tests.ts.tscparams} | 0 java-applet/{java.d.ts => java-applet.d.ts} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename java-applet/{java-tests.ts => java-applet-tests.ts} (88%) rename java-applet/{java-tests.ts.tscparams => java-applet-tests.ts.tscparams} (100%) rename java-applet/{java.d.ts => java-applet.d.ts} (100%) diff --git a/java-applet/java-tests.ts b/java-applet/java-applet-tests.ts similarity index 88% rename from java-applet/java-tests.ts rename to java-applet/java-applet-tests.ts index 8bbbaea994..6705279997 100644 --- a/java-applet/java-tests.ts +++ b/java-applet/java-applet-tests.ts @@ -1,4 +1,4 @@ -/// +/// /** * @summary Test for the applet status. @@ -19,4 +19,4 @@ function testHandlers() { onLoad: handler, onStop: handler }; -} \ No newline at end of file +} diff --git a/java-applet/java-tests.ts.tscparams b/java-applet/java-applet-tests.ts.tscparams similarity index 100% rename from java-applet/java-tests.ts.tscparams rename to java-applet/java-applet-tests.ts.tscparams diff --git a/java-applet/java.d.ts b/java-applet/java-applet.d.ts similarity index 100% rename from java-applet/java.d.ts rename to java-applet/java-applet.d.ts From 74b68be6cc87705072a819586d8bf6eb943a07ed Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Mon, 9 Feb 2015 15:55:03 +0100 Subject: [PATCH 5/5] Update header. --- java-applet/java-applet.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java-applet/java-applet.d.ts b/java-applet/java-applet.d.ts index 44660aa32b..0102b3b75b 100644 --- a/java-applet/java-applet.d.ts +++ b/java-applet/java-applet.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Java +// Type definitions for Java Applet // Project: https://www.java.com/ // Definitions by: Cyril Schumacher // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -49,4 +49,4 @@ interface Java { * @summary Applet Status. */ status?: AppletStatus; -} \ No newline at end of file +}