diff --git a/java-applet/java-applet-tests.ts b/java-applet/java-applet-tests.ts index 6705279997..cf652a4430 100644 --- a/java-applet/java-applet-tests.ts +++ b/java-applet/java-applet-tests.ts @@ -1,22 +1,29 @@ /// /** - * @summary Test for the applet status. + * @summary Test for the typage. + */ +function testTypage() { + var applet: HTMLAppletElement = document.getElementById('applet'); + var javaApplet: JavaApplet = applet; +} + +/** + * @summary Test for the java applet status. */ function testStatus() { - var java: Java = { - status: AppletStatus.Loading - }; + var applet: JavaApplet = document.getElementById('applet'); + var status: number = applet.status; } /** * @summary Test for the handlers. */ function testHandlers() { + var applet: JavaApplet = document.getElementById('applet'); + var handler: Function = () => {}; - var java: Java = { - onError: handler, - onLoad: handler, - onStop: handler - }; -} + applet.onError = handler; + applet.onLoad = handler; + applet.onStop = handler; +} \ No newline at end of file diff --git a/java-applet/java-applet.d.ts b/java-applet/java-applet.d.ts index 0102b3b75b..982e71a1c6 100644 --- a/java-applet/java-applet.d.ts +++ b/java-applet/java-applet.d.ts @@ -4,10 +4,11 @@ // 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} + * @summary Java applet Status. More details: {@link http://docs.oracle.com/javase/8/docs/technotes/guides/deploy/applet_dev_guide.html#JSDPG719|Applet Status And Event Handlers} + * @enum {number} + * @readonly */ -declare enum AppletStatus { +declare enum JavaAppletStatus { /** * @summary Applet is loading. */ @@ -25,28 +26,32 @@ declare enum AppletStatus { } /** - * @summary Interface for Java object. + * @summary Interface for Java applet object. * @author Cyril Schumacher * @version 1.0 */ -interface Java { +interface JavaApplet extends HTMLAppletElement { /** - * Handler if the applet status is ERROR. An error has occurred while loading the applet. + * @summary Handler if the applet status is {@link JavaAppletStatus#Error}. An error has occurred while loading the applet. + * @type {Function} */ onError?: Function; /** - * Handler if the applet status is READY. Applet has finished loading and is ready to receive JavaScript calls. + * @summary Handler if the applet status is {@link JavaAppletStatus#Ready}. Applet has finished loading and is ready to receive JavaScript calls. + * @type {Function} */ onLoad?: Function; /** - * Handler if the applet has stopped. + * @summary Handler if the applet has stopped. + * @type {Function} */ onStop?: Function; /** - * @summary Applet Status. + * @summary Java applet Status. + * @type {JavaAppletStatus} */ - status?: AppletStatus; + status?: JavaAppletStatus; }