diff options
Diffstat (limited to 'files/es/archive/web')
13 files changed, 523 insertions, 0 deletions
diff --git a/files/es/archive/web/index.html b/files/es/archive/web/index.html new file mode 100644 index 0000000000..8ca15839ca --- /dev/null +++ b/files/es/archive/web/index.html @@ -0,0 +1,12 @@ +--- +title: Archived open Web documentation +slug: Archive/Web +tags: + - Archived + - NeedsTranslation + - TopicStub + - Web +translation_of: Archive/Web +--- +<p>The documentation listed below is archived, obsolete material about open Web topics.</p> +<p></p><dl><dt class="landingPageList"><a href="/es/docs/E4X">E4X</a></dt><dd class="landingPageList"><strong>ECMAScript for XML</strong> (<strong>E4X</strong>) es una extensión del lenguaje de programación que añade la implementación de XML nativo a <a href="/es/JavaScript" title="es/JavaScript">JavaScript</a>. Esto proporciona el acceso al documento de XML de manera que sea natural para los programadores de ECMAScript. El objetivo es proporcionar una alternativa, una sintaxis más simple para tener acceso a documentos XML a través de las interfaces <a href="/es/DOM" title="es/DOM">DOM</a>.</dd><dt class="landingPageList"><a href="/es/docs/Archive/Web/LiveConnect">LiveConnect</a></dt><dd class="landingPageList"></dd></dl><p></p> diff --git a/files/es/archive/web/javascript/index.html b/files/es/archive/web/javascript/index.html new file mode 100644 index 0000000000..4687b7bf23 --- /dev/null +++ b/files/es/archive/web/javascript/index.html @@ -0,0 +1,12 @@ +--- +title: JavaScript +slug: Archive/Web/JavaScript +translation_of: Archive/Web/JavaScript +--- +<div class="hidden">{{JSRef}}</div> + +<p>{{Obsolete_Header}}</p> + +<p class="summary">Obsolete JavaScript features and unmaintained docs</p> + +<p>{{SubpagesWithSummaries}}</p> diff --git a/files/es/archive/web/javascript/legacy_generator_function_statement/index.html b/files/es/archive/web/javascript/legacy_generator_function_statement/index.html new file mode 100644 index 0000000000..75efe9f447 --- /dev/null +++ b/files/es/archive/web/javascript/legacy_generator_function_statement/index.html @@ -0,0 +1,63 @@ +--- +title: Función generadora de legado +slug: Archive/Web/JavaScript/Legacy_generator_function_statement +tags: + - Iterador Legado + - JavaScript + - Referencia +translation_of: Archive/Web/JavaScript/Legacy_generator_function_statement +--- +<div class="warning">La función generadora de legado es una característica específica de SpiderMonkey, y será eliminida en Firefox 58+. Para futuros usos, considera usar {{jsxref("Statements/function*", "function*")}}.</div> + +<div>{{jsSidebar("Statements")}}</div> + +<p>La <strong>sentencia de función generadora de legado</strong> declara funciones generadoras con unos parámetros específicos.</p> + +<p>También se pueden definir funciones usando el constructor {{jsxref("Function")}} con <code>functionBody</code> y al menos una expresión {{jsxref("Operadores/yield", "yield")}}, y una función {{jsxref("Operators/Legacy_generator_function", "legacy generator function expression", "", 1)}}.</p> + +<h2 id="Sintaxis">Sintaxis</h2> + +<pre class="syntaxbox">function <em>nombre</em>([<em>parámetro</em>,[, <em>parámetro</em>,[..., <em>parámetro</em>]]]) { + [<em>sentencias</em>] +} +</pre> + +<dl> + <dt><code>nombre</code></dt> + <dd>Nombre de la función.</dd> +</dl> + +<dl> + <dt><code>parámetro</code></dt> + <dd>El nombre de un argumento pasado a la función. Una función puede tener hasta 255 argumentos.</dd> +</dl> + +<dl> + <dt><font face="Consolas, Liberation Mono, Courier, monospace">sentencias</font></dt> + <dd>Las sentencias que componen el cuerpo de la función. Debe contener al menos una expresion {{jsxref("Operadores/yield", "yield")}}.</dd> +</dl> + +<h2 id="Descripción">Descripción</h2> + +<p>Una introducción de su uso está disponible en la página de <a href="/en-US/docs/JavaScript/Guide/Iterators_and_Generators" title="/en-US/docs/JavaScript/Guide/Iterators_and_Generators">Iteradores y Generadores</a>.</p> + +<h2 id="Compatibilidad_de_navegadores">Compatibilidad de navegadores</h2> + +<p>Supported nowhere.</p> + +<h2 id="Vea_también">Vea también</h2> + +<ul> + <li>{{jsxref("Generator")}}</li> + <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Legacy_generator_function">La expresión de función generadora de legado</a></li> + <li><a href="/en-US/docs/Web/JavaScript/Guide/The_legacy_Iterator_protocol">El protocolo del Iterador legado</a></li> + <li>{{jsxref("Operadores/yield", "yield")}}</li> + <li><a href="/es/docs/Web/JavaScript/Referencia/Funciones" title="JavaScript/Referencia/Funciones_y_alcance_de_funciones">Funciones y alcance de funciones</a></li> + <li>{{jsxref("Sentencias/function", "function")}}</li> + <li>{{jsxref("Operadores/function", "function expression")}}</li> + <li>{{jsxref("Function")}}</li> + <li>{{jsxref("Sentencias/function*", "function*")}}</li> + <li>{{jsxref("Operadores/function*", "function* expression")}}</li> + <li>{{jsxref("GeneratorFunction")}}</li> + <li><a href="/en-US/docs/Web/JavaScript/Guide/The_Iterator_protocol">El protocolo Iterator</a></li> +</ul> diff --git a/files/es/archive/web/javascript/proximo_soporte_de_ecmascript_en_mozilla/index.html b/files/es/archive/web/javascript/proximo_soporte_de_ecmascript_en_mozilla/index.html new file mode 100644 index 0000000000..763fb63dfa --- /dev/null +++ b/files/es/archive/web/javascript/proximo_soporte_de_ecmascript_en_mozilla/index.html @@ -0,0 +1,85 @@ +--- +title: Próximo soporte de ECMAScript en Mozilla +slug: Archive/Web/JavaScript/Proximo_soporte_de_ECMAScript_en_Mozilla +tags: + - ECMAScript + - JavaScript +translation_of: Archive/Web/JavaScript/ECMAScript_Next_support_in_Mozilla +--- +<div>{{jsSidebar("New_in_JS")}}</div> + +<p>Próximo ECMAScript hace referencia a las nuevas características del estándar ECMA-262 (comúnmente llamado JavaScript) introducido después de ECMAScript 2015. Las nuevas versiones de las especificaciones de ECMAScript serán liberadas anualmente. Este año, la especificación ES2016 será liberada y ES2017 es la actual especificación en borrador.</p> + +<p>Puedes ver la última propuesta en el repositorio de GitHub <a href="https://github.com/tc39/ecma262">tc39/ecma262</a>.</p> + +<p>Un canal de retroalimentación para los estándares de ECMAScript es <a href="https://mail.mozilla.org/listinfo/es-discuss">es-discuss</a>.</p> + +<h2 id="ECMAScript_2016">ECMAScript 2016</h2> + +<p>Estas características de ES2016 están implementadas:</p> + +<ul> + <li>{{jsxref("Array.prototype.includes()")}} (Firefox 43)</li> + <li>{{jsxref("TypedArray.prototype.includes()")}} (Firefox 43)</li> + <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/function*">Generadores</a> y <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions">métodos de generador</a> ya no son construibles (Firefox 43)</li> + <li>Se ha removido el manejador de <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler/enumerate">enumerador</a> de Proxy (Firefox 47)</li> + <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Exponentiation">Operador de exponenciación</a> (Firefox 52)</li> + <li>{{jsxref("Functions/rest_parameters", "Parámetro de desestructuración Rest", "#Destructuring_rest_parameters", 1)}} (Firefox 52)</li> +</ul> + +<h2 id="ECMAScript_2017">ECMAScript 2017</h2> + +<p>Estas características de ES2017 están implementadas:</p> + +<ul> + <li>{{jsxref("Object.values()")}} y {{jsxref("Object.entries()")}} (Firefox 47)</li> + <li>{{jsxref("String.prototype.padEnd()")}} (Firefox 48)</li> + <li>{{jsxref("String.prototype.padStart()")}} (Firefox 48)</li> + <li>{{jsxref("Object.getOwnPropertyDescriptors()")}} (Firefox 50)</li> + <li>Funciones asíncronas + <ul> + <li>{{jsxref("Statements/async_function", "async function")}} (Firefox 52)</li> + <li>{{jsxref("Operators/async_function", "async function expression")}} (Firefox 52)</li> + <li>{{jsxref("AsyncFunction")}} (Firefox 52)</li> + <li>{{jsxref("Operators/await", "await")}} (Firefox 52)</li> + </ul> + </li> + <li><a href="/en-US/docs/Web/JavaScript/Reference/Trailing_commas">Arrastre de comas en la lista de parámetros de una función</a> (Firefox 52)</li> +</ul> + +<h2 id="Nuevas_características_experimentales">Nuevas características experimentales</h2> + +<p>Las siguientes características ya están implementadas, pero sólo disponibles en el <a href="http://nightly.mozilla.org/">Canal Firefox Nightly</a> y aún no incluidas en la edición de borrador de alguna especificación ECMAScript.</p> + +<h3 id="Adiciones_al_objeto_ArrayBuffer">Adiciones al objeto <code>ArrayBuffer</code></h3> + +<ul> + <li>{{jsxref("ArrayBuffer.transfer()")}} (<a href="https://gist.github.com/lukewagner/2735af7eea411e18cf20">spec</a>)</li> +</ul> + +<h3 id="Nuevos_objetos_TypedObject">Nuevos objetos TypedObject</h3> + +<ul> + <li><a href="https://github.com/dslomov-chromium/typed-objects-es7">Borrador de Objetos Tipados</a></li> +</ul> + +<h3 id="Nuevos_objetos_SIMD">Nuevos objetos SIMD</h3> + +<ul> + <li><a href="https://github.com/johnmccutchan/ecmascript_simd">Borrador de especificación SIMD y polyfill</a></li> +</ul> + +<h3 id="Nuevos_objetos_de_Memoria_Compartida">Nuevos objetos de Memoria Compartida</h3> + +<ul> + <li>{{jsxref("SharedArrayBuffer")}}</li> + <li>{{jsxref("Atomics")}}</li> +</ul> + +<h2 id="Ver_también">Ver también</h2> + +<ul> + <li><a href="http://www.ecmascript.org/">Sitio web de ECMAScript</a></li> + <li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1021376">Mozilla ES2016 tracking bug</a></li> + <li><a href="http://kangax.github.io/compat-table/esnext/">ECMAScript next support across browsers</a></li> +</ul> diff --git a/files/es/archive/web/liveconnect/index.html b/files/es/archive/web/liveconnect/index.html new file mode 100644 index 0000000000..328b6d2678 --- /dev/null +++ b/files/es/archive/web/liveconnect/index.html @@ -0,0 +1,23 @@ +--- +title: LiveConnect +slug: Archive/Web/LiveConnect +tags: + - AJAX + - Guía_de_JavaScript_1.5 + - JavaScript + - Referencia_de_JavaScript_1.5 + - Todas_las_Categorías +translation_of: Archive/Web/LiveConnect/LiveConnect_Reference +--- +<p> +</p><p>This section documents the Java classes used for <a href="es/LiveConnect">LiveConnect</a>, along with their constructors and methods. These classes allow a Java object to access JavaScript code. +</p><p><a href="es/Referencia_de_JavaScript_1.5/LiveConnect/JSException">JSException</a> +</p> +<dl><dd> The public class <code>JSException</code> extends <code>RuntimeException</code>, and is thrown when JavaScript returns an error. +</dd></dl> +<p><a href="es/Referencia_de_JavaScript_1.5/LiveConnect/JSObject">JSObject</a> +</p> +<dl><dd> The public class <code>JSObject</code> extends <code>Object</code>. JavaScript objects are wrapped in an instance of the class <code>JSObject</code> and passed to Java, allowing Java to manipulate JavaScript objects. +</dd></dl> +<div class="noinclude"> +</div> diff --git a/files/es/archive/web/liveconnect/java/index.html b/files/es/archive/web/liveconnect/java/index.html new file mode 100644 index 0000000000..46df56223d --- /dev/null +++ b/files/es/archive/web/liveconnect/java/index.html @@ -0,0 +1,15 @@ +--- +title: java +slug: Archive/Web/LiveConnect/java +translation_of: Archive/Web/LiveConnect_Reference/java +--- +<p>Resumen</p> +<p><strong>Objeto Global</strong></p> +<p>Un objeto de alto nivel utilizado para acceder a cualquier clase Java del paquete <code>java.*</code>.</p> +<h3 id="Created_by" name="Created_by">Creado por</h3> +<p>El objeto <code>java</code> es un objeto Javascript predefinido de alto nivel. Puedes acceder a él de forma automática sin utilizar un constructor o sin llamar a un método.</p> +<h3 id="Descripci.C3.B3n" name="Descripci.C3.B3n">Descripción</h3> +<p>El objeto <code>java</code> es un buen sinónimo de la propiedad <code>Packages.java</code>.</p> +<h3 id="Ver_tambi.C3.A9n" name="Ver_tambi.C3.A9n">Ver también</h3> +<p><a href="/es/Referencia_de_JavaScript_1.5/Objetos_globales#Paquetes" title="es/Referencia_de_JavaScript_1.5/Objetos_globales#Paquetes">Paquetes</a>, <a href="/es/Referencia_de_JavaScript_1.5/Objetos_globales#Paquetes:java" title="es/Referencia_de_JavaScript_1.5/Objetos_globales#Paquetes:java">Packages.java</a></p> +<p></p> diff --git a/files/es/archive/web/liveconnect/javaarray/index.html b/files/es/archive/web/liveconnect/javaarray/index.html new file mode 100644 index 0000000000..1ec785bfc5 --- /dev/null +++ b/files/es/archive/web/liveconnect/javaarray/index.html @@ -0,0 +1,65 @@ +--- +title: JavaArray +slug: Archive/Web/LiveConnect/JavaArray +translation_of: Archive/Web/LiveConnect_Reference/JavaArray +--- +<p> +</p> +<h3 id="Summary" name="Summary"> Summary </h3> +<p><b>Core Object</b> +</p><p>A wrapped Java array accessed from within JavaScript code is a member of the type <code>JavaArray</code>. +</p> +<h3 id="Created_by" name="Created_by"> Created by </h3> +<p>Any Java method which returns an array. In addition, you can create a <code>JavaArray</code> with an arbitrary data type using the <code>newInstance</code> method of the <code>Array</code> class: +</p> +<pre class="eval">public static Object newInstance(Class componentType, + int length) + throws NegativeArraySizeException +</pre> +<h3 id="Description" name="Description"> Description </h3> +<p>The <code>JavaArray</code> object is an instance of a Java array that is created in or passed to JavaScript. <code>JavaArray</code> is a wrapper for the instance; all references to the array instance are made through the <code>JavaArray</code>. +</p><p>In JavaScript 1.4 and later, the <code>componentType</code> parameter is either a <code>JavaClass</code> object representing the type of the array or class object, such as one returned by <code>java.lang.Class.forName</code>. In JavaScript 1.3 and earlier, <code>componentType</code> must be a class object. +</p><p>Use zero-based indexes to access the elements in a <code>JavaArray</code> object, just as you do to access elements in an array in Java. For example: +</p> +<pre class="eval">var javaString = new java.lang.String("Hello world!"); +var byteArray = javaString.getBytes(); +byteArray[0] // returns 72 +byteArray[1] // returns 101 +</pre> +<p>Any Java data brought into JavaScript is converted to JavaScript data types. When the <code>JavaArray</code> is passed back to Java, the array is unwrapped and can be used by Java code. See the <a href="es/Core_JavaScript_1.5_Guide">Core JavaScript 1.5 Guide</a> for more information about data type conversions. +</p><p>In JavaScript 1.4 and later, the methods of <code>java.lang.Object</code> are inherited by <code>JavaArray</code>. +</p> +<h3 id="Backward_compatibility" name="Backward_compatibility"> Backward compatibility </h3> +<h4 id="JavaScript_1.3_and_earlier" name="JavaScript_1.3_and_earlier"> JavaScript 1.3 and earlier </h4> +<p>The methods of <code>java.lang.Object</code> are not inherited by <code>JavaArray</code>. In addition, the <code>toString</code> method is inherited from the <code>Object</code> object and returns the following value: +</p> +<pre class="eval">[object JavaArray] +</pre> +<p>You must specify a class object, such as one returned by <code>java.lang.Object.forName</code>, for the <code>componentType</code> parameter of <code>newInstance</code> when you use this method to create an array. You cannot use a <code>JavaClass</code> object for the <code>componentType</code> parameter. +</p> +<h3 id="Properties" name="Properties"> Properties </h3> +<p><a href="es/Core_JavaScript_1.5_Reference/Global_Objects/JavaArray/length">length</a>: The number of elements in the Java array represented by <code>JavaArray</code>. +</p> +<h3 id="Methods" name="Methods"> Methods </h3> +<p><a href="es/Core_JavaScript_1.5_Reference/Global_Objects/JavaArray/toString">toString</a>: In JavaScript 1.4, this method is overridden by the inherited method <code>java.lang.Object.toString</code>. in JavaScript 1.3 and earlier, this method returns a string identifying the object as a <code>JavaArray</code>. +</p><p>In JavaScript 1.4 and later, <code>JavaArray</code> also inherits methods from the Java array superclass, <code>java.lang.Object</code>. +</p> +<h3 id="Examples" name="Examples"> Examples </h3> +<h4 id="Example:_Instantiating_a_JavaArray_in_JavaScript" name="Example:_Instantiating_a_JavaArray_in_JavaScript"> Example: Instantiating a <code>JavaArray</code> in JavaScript </h4> +<p>In this example, the <code>JavaArray</code> <code>byteArray</code> is created by the <code>java.lang.String.getBytes</code> method, which returns an array. +</p> +<pre class="eval">var javaString = new java.lang.String("Hello world!"); +var byteArray = javaString.getBytes(); +</pre> +<h4 id="Example:_Instantiating_a_JavaArray_in_JavaScript_with_the_newInstance_method" name="Example:_Instantiating_a_JavaArray_in_JavaScript_with_the_newInstance_method"> Example: Instantiating a <code>JavaArray</code> in JavaScript with the <code>newInstance</code> method </h4> +<p>In JavaScript 1.4, you can use a <code>JavaClass</code> object as the argument for the <code>newInstance</code> method which creates the array, as shown in the following code: +</p> +<pre class="eval">var dogs = java.lang.reflect.Array.newInstance(java.lang.String, 5); +</pre> +<p>In JavaScript 1.1, use a class object returned by <code>java.lang.Class.forName</code> as the argument for the newInstance method, as shown in the following code: +</p> +<pre class="eval">var dataType = java.lang.Class.forName("java.lang.String"); +var dogs = java.lang.reflect.Array.newInstance(dataType, 5); +</pre> +<div class="noinclude"> +</div> diff --git a/files/es/archive/web/liveconnect/javaclass/index.html b/files/es/archive/web/liveconnect/javaclass/index.html new file mode 100644 index 0000000000..75ebf01604 --- /dev/null +++ b/files/es/archive/web/liveconnect/javaclass/index.html @@ -0,0 +1,64 @@ +--- +title: JavaClass +slug: Archive/Web/LiveConnect/JavaClass +tags: + - páginas_a_traducir +translation_of: Archive/Web/LiveConnect_Reference/JavaClass +--- +<h3 id="Resumen" name="Resumen">Resumen</h3> + +<p><strong>Objeto Global</strong></p> + +<p>Una referencia JavaScript de una clase Java.</p> + +<h3 id="Created_by" name="Created_by">Creado por</h3> + +<p>Una referencia del nombre de clase utilizada en el objeto <code>Packages</code>:</p> + +<pre class="eval">Packages.<em>JavaClass</em> +</pre> + +<p><em>JavaClass</em> es el nombre completo de la clase Java. Los objetos LiveConnect <code>java</code>, <code>sun</code>, y <code>netscape</code> ofrecen accesos directos para los paquetes Java más utilizados, además de crear objetos <code>JavaClass</code>.</p> + +<h3 id="Descripci.C3.B3n" name="Descripci.C3.B3n">Descripción</h3> + +<p>Un objeto <code>JavaClass</code> es una referencia a una de las clases de un paquete Java, como <code>netscape.javascript.JSObject</code>. Un objeto <code>JavaPackage</code> es una referencia a un paquete Java, como <code>netscape.javascript</code>. En JavaScript, las jerarquías <code>JavaPackage</code> y <code>JavaClass</code> reflejan el paquete Java y la jeraquía de clases.</p> + +<p>Puedes pasar un objeto <code>JavaClass</code> a un método Java que requiera un argumento de tipo <code>java.lang.Class</code>.</p> + +<h3 id="Backward_compatibility" name="Backward_compatibility">Compatibilidad hacia atrás</h3> + +<h4 id="JavaScript_1.3_y_earlier" name="JavaScript_1.3_y_earlier">JavaScript 1.3 y anteriores</h4> + +<p>Debes crear un contenedor y meter dentro una instancia de <code>java.lang.Class</code> antes de pasarlo como parámetro a un método Java -- los objetos <code>JavaClass</code> no se convierten de forma automática a instancias de <code>java.lang.Class</code>.</p> + +<h3 id="Propiedades" name="Propiedades">Propiedades</h3> + +<p>Las propiedades de un objeto <code>JavaClass</code> son los campos estáticos de la clase Java.</p> + +<h3 id="M.C3.A9todos" name="M.C3.A9todos">Métodos</h3> + +<p>Los métodos de un objeto <code>JavaClass</code> son los métodos estáticos de la clase Java.</p> + +<h3 id="Ejemplos" name="Ejemplos">Ejemplos</h3> + +<h4 id="Ejemplos:_Utilizando_JavaClass" name="Ejemplos:_Utilizando_JavaClass">Ejemplos: Utilizando <code>JavaClass</code></h4> + +<p>En el siguiente ejemplo, <code>x</code> es un objeto JavaClass que hace referencia a java.awt.Font. Debido a que BOLD es un campo estático de la clase Font, también es una propiedad del objeto JavaClass.</p> + +<pre class="eval">x = java.awt.Font; +myFont = x("helv", x.BOLD, 10); // crea un objeto Font +</pre> + +<p>El ejemplo anterior omite <code>Packages</code> y utiliza el sinónimo <code>java</code> debido a que la clase <code>Font</code> está en el paquete <code>java</code>.</p> + +<h4 id="Ejemplos_2" name="Ejemplos_2">Ejemplos</h4> + +<p>En el siguiente ejemplo, el objeto <code>java.lang.String </code>de <code>JavaClass</code> se pasa como un argumento al método <code>newInstance</code> creando un array:</p> + +<pre class="eval">var cars = java.lang.reflect.Array.newInstance(java.lang.String, 15); +</pre> + +<h3 id="Ver_tambi.C3.A9n" name="Ver_tambi.C3.A9n">Ver también</h3> + +<p><a href="/es/Referencia_de_JavaScript_1.5/Objetos_globales#JavaArray" title="es/Referencia_de_JavaScript_1.5/Objetos_globales#JavaArray">JavaArray</a>, <a href="/es/Referencia_de_JavaScript_1.5/Objetos_globales#JavaObject" title="es/Referencia_de_JavaScript_1.5/Objetos_globales#JavaObject">Objeto Java</a>, <a href="/es/Referencia_de_JavaScript_1.5/Objetos_globales#JavaPackage" title="es/Referencia_de_JavaScript_1.5/Objetos_globales#JavaPackage">Empaquetado Java</a>, <a href="/es/Referencia_de_JavaScript_1.5/Objetos_globales#Packages" title="es/Referencia_de_JavaScript_1.5/Objetos_globales#Packages">Paquetes</a></p> diff --git a/files/es/archive/web/liveconnect/javaobject/index.html b/files/es/archive/web/liveconnect/javaobject/index.html new file mode 100644 index 0000000000..7248cef567 --- /dev/null +++ b/files/es/archive/web/liveconnect/javaobject/index.html @@ -0,0 +1,61 @@ +--- +title: JavaObject +slug: Archive/Web/LiveConnect/JavaObject +translation_of: Archive/Web/LiveConnect_Reference/JavaObject +--- +<p> +</p> +<h3 id="Summary" name="Summary"> Summary </h3> +<p><b>Core Object</b> +</p><p>The type of a wrapped Java object accessed from within JavaScript code. +</p> +<h3 id="Created_by" name="Created_by"> Created by </h3> +<p>Any Java method which returns an object type. In addition, you can explicitly construct a <code>JavaObject</code> using the object's Java constructor with the <code>Packages</code> keyword: +</p> +<pre class="eval">new Packages.<i>JavaClass</i>(<i>parameterList</i>) +</pre> +<p><i>JavaClass</i> is the fully-specified name of the object's Java class. +</p> +<h3 id="Parameters" name="Parameters"> Parameters </h3> +<dl><dt> <code>parameterList</code> </dt><dd> An optional list of parameters, specified by the constructor of the Java class. +</dd></dl> +<h3 id="Description" name="Description"> Description </h3> +<p>The <code>JavaObject</code> object is an instance of a Java class that is created in or passed to JavaScript. <code>JavaObject</code> is a wrapper for the instance; all references to the class instance are made through the <code>JavaObject</code>. +</p><p>Any Java data brought into JavaScript is converted to JavaScript data types. When the <code>JavaObject</code> is passed back to Java, it is unwrapped and can be used by Java code. See the <a href="es/Core_JavaScript_1.5_Guide">Core JavaScript 1.5 Guide</a> for more information about data type conversions. +</p> +<h3 id="Properties" name="Properties"> Properties </h3> +<p>Inherits public data members from the Java class of which it is an instance as properties. It also inherits public data members from any superclass as properties. +</p> +<h3 id="Methods" name="Methods"> Methods </h3> +<p>Inherits public methods from the Java class of which it is an instance. The <code>JavaObject</code> also inherits methods from <code>java.lang.Object</code> and any other superclass. +</p> +<h3 id="Examples" name="Examples"> Examples </h3> +<h4 id="Example:_Instantiating_a_Java_Object_in_JavaScript" name="Example:_Instantiating_a_Java_Object_in_JavaScript"> Example: Instantiating a Java Object in JavaScript </h4> +<p>The following code creates the <code>JavaObject</code> <code>theString</code>, which is an instance of the class <code>java.lang.String</code>: +</p> +<pre class="eval">var theString = new Packages.java.lang.String("Hello, world"); +</pre> +<p>Because the <code>String</code> class is in the <code>java</code> package, you can also use the java synonym and omit the <code>Packages</code> keyword when you instantiate the class: +</p> +<pre class="eval">var theString = new java.lang.String("Hello, world"); +</pre> +<h4 id="Example:_Accessing_methods_of_a_Java_object" name="Example:_Accessing_methods_of_a_Java_object"> Example: Accessing methods of a Java object </h4> +<p>Because the <code>JavaObject</code> <code>theString</code> is an instance of <code>java.lang.String</code>, it inherits all the public methods of <code>java.lang.String</code>. The following example uses the <code>startsWith</code> method to check whether <code>theString</code> begins with "Hello". +</p> +<pre class="eval">var theString = new java.lang.String("Hello, world"); +theString.startsWith("Hello"); // returns true +</pre> +<h4 id="Example:_Accessing_inherited_methods" name="Example:_Accessing_inherited_methods"> Example: Accessing inherited methods </h4> +<p>Because <code>getClass</code> is a method of <code>Object</code>, and <code>java.lang.String</code> extends <code>Object</code>, the <code>String</code> class inherits the <code>getClass</code> method. Consequently, <code>getClass</code> is also a method of the <code>JavaObject</code> which instantiates <code>String</code> in JavaScript. +</p> +<pre class="eval">var theString = new java.lang.String("Hello, world"); +theString.getClass(); // returns java.lang.String +</pre> +<h3 id="See_also" name="See_also"> See also </h3> +<p><a href="es/Core_JavaScript_1.5_Reference/Global_Objects/JavaArray">JavaArray</a>, +<a href="es/Core_JavaScript_1.5_Reference/Global_Objects/JavaClass">JavaClass</a>, +<a href="es/Core_JavaScript_1.5_Reference/Global_Objects/JavaPackage">JavaPackage</a>, +<a href="es/Core_JavaScript_1.5_Reference/Global_Objects/Packages">Packages</a> +</p> +<div class="noinclude"> +</div> diff --git a/files/es/archive/web/liveconnect/javapackage/index.html b/files/es/archive/web/liveconnect/javapackage/index.html new file mode 100644 index 0000000000..091300cd5e --- /dev/null +++ b/files/es/archive/web/liveconnect/javapackage/index.html @@ -0,0 +1,39 @@ +--- +title: JavaPackage +slug: Archive/Web/LiveConnect/JavaPackage +translation_of: Archive/Web/LiveConnect_Reference/JavaPackage +--- +<p> +</p> +<h3 id="Summary" name="Summary"> Summary </h3> +<p><b>Core Object</b> +</p><p>A JavaScript reference to a Java package. +</p> +<h3 id="Created_by" name="Created_by"> Created by </h3> +<p>A reference to the package name used with the <code>Packages</code> keyword: +</p> +<pre class="eval">Packages.<i>JavaPackage</i> +</pre> +<p><i>JavaPackage</i> is the name of the object's Java package. If the package is in the <code>java</code>, <code>netscape</code>, or <code>sun</code> packages, the <code>Packages</code> keyword is optional. +</p> +<h3 id="Description" name="Description"> Description </h3> +<p>In Java, a package is a collection of Java classes or other Java packages. For example, the <code>netscape</code> package contains the package <code>netscape.javascript</code>; the <code>netscape.javascript</code> package contains the classes <code>JSObject</code> and <code>JSException</code>. +</p><p>In JavaScript, a <code>JavaPackage</code> is a reference to a Java package. For example, a reference to <code>netscape</code> is a <code>JavaPackage</code>. <code>netscape.javascript</code> is both a <code>JavaPackage</code> and a property of the <code>netscape</code> JavaPackage. +</p><p>A <code>JavaClass</code> object is a reference to one of the classes in a package, such as <code>netscape.javascript.JSObject</code>. The <code>JavaPackage</code> and <code>JavaClass</code> hierarchy reflect the Java package and class hierarchy. +</p><p>Although the packages and classes contained in a <code>JavaPackage</code> are its properties, you cannot use a <code>for...in</code> statement to enumerate them as you can enumerate the properties of other objects. </p> +<h3 id="Properties" name="Properties"> Properties </h3> +<p>The properties of a <code>JavaPackage</code> are the <code>JavaClass</code> objects and any other <code>JavaPackage</code> objects it contains. +</p> +<h3 id="Examples" name="Examples"> Examples </h3> +<p>Suppose the Redwood corporation uses the Java <code>redwood</code> package to contain various Java classes that it implements. The following code creates the <code>JavaPackage</code> red: +</p> +<pre class="eval">var red = Packages.redwood; +</pre> +<h3 id="See_also" name="See_also"> See also </h3> +<p><a href="es/Core_JavaScript_1.5_Reference/Global_Objects/JavaArray">JavaArray</a>, +<a href="es/Core_JavaScript_1.5_Reference/Global_Objects/JavaClass">JavaClass</a>, +<a href="es/Core_JavaScript_1.5_Reference/Global_Objects/JavaObject">JavaObject</a>, +<a href="es/Core_JavaScript_1.5_Reference/Global_Objects/Packages">Packages</a> +</p> +<div class="noinclude"> +</div> diff --git a/files/es/archive/web/liveconnect/netscape/index.html b/files/es/archive/web/liveconnect/netscape/index.html new file mode 100644 index 0000000000..85d8eabb95 --- /dev/null +++ b/files/es/archive/web/liveconnect/netscape/index.html @@ -0,0 +1,23 @@ +--- +title: netscape +slug: Archive/Web/LiveConnect/netscape +translation_of: Archive/Web/LiveConnect_Reference/netscape +--- +<p> +</p> +<h3 id="Summary" name="Summary"> Summary </h3> +<p><b>Core Object</b> +</p><p>A top-level object used to access any Java class in the package <code>netscape.*</code>. +</p> +<h3 id="Created_by" name="Created_by"> Created by </h3> +<p>The <code>netscape</code> object is a top-level, predefined JavaScript object. You can automatically access it without using a constructor or calling a method. +</p> +<h3 id="Description" name="Description"> Description </h3> +<p>The <code>netscape</code> object is a convenient synonym for the property <code>Packages.netscape</code>. +</p> +<h3 id="See_Also" name="See_Also"> See Also </h3> +<p><a href="es/Core_JavaScript_1.5_Reference/Global_Objects/Packages">Packages</a>, +<a href="es/Core_JavaScript_1.5_Reference/Global_Objects/Packages/netscape">Packages.netscape</a> +</p> +<div class="noinclude"> +</div> diff --git a/files/es/archive/web/liveconnect/packages/index.html b/files/es/archive/web/liveconnect/packages/index.html new file mode 100644 index 0000000000..c66265507d --- /dev/null +++ b/files/es/archive/web/liveconnect/packages/index.html @@ -0,0 +1,44 @@ +--- +title: Packages +slug: Archive/Web/LiveConnect/Packages +translation_of: Archive/Web/LiveConnect_Reference/Packages +--- +<p> +</p> +<h3 id="Summary" name="Summary"> Summary </h3> +<p><b>Core Object</b> +</p><p>A top-level object used to access Java classes from within JavaScript code. +</p> +<h3 id="Created_by" name="Created_by"> Created by </h3> +<p>The <code>Packages</code> object is a top-level, predefined JavaScript object. You can automatically access it without using a constructor or calling a method. +</p> +<h3 id="Description" name="Description"> Description </h3> +<p>The <code>Packages</code> object lets you access the public methods and fields of an arbitrary Java class from within JavaScript. The <code>java</code>, <code>netscape</code>, and <code>sun</code> properties represent the packages <code>java.*</code>, <code>netscape.*</code>, and <code>sun.*</code> respectively. Use standard Java dot notation to access the classes, methods, and fields in these packages. For example, you can access a constructor of the <code>Frame</code> class as follows: +</p> +<pre class="eval">var theFrame = new Packages.java.awt.Frame(); +</pre> +<p>For convenience, JavaScript provides the top-level <code>netscape</code>, <code>sun</code>, and <code>java</code> objects that are synonyms for the Packages properties with the same names. Consequently, you can access Java classes in these packages without the Packages keyword, as follows: +</p> +<pre class="eval">var theFrame = new java.awt.Frame(); +</pre> +<p>The <code>className</code> property represents the fully qualified path name of any other Java class that is available to JavaScript. You must use the <code>Packages</code> object to access classes outside the <code>netscape</code>, <code>sun</code>, and <code>java</code> packages. +</p> +<h3 id="Properties" name="Properties"> Properties </h3> +<p><a href="es/Core_JavaScript_1.5_Reference/Global_Objects/Packages/className">className</a>: The fully qualified name of a Java class in a package other than netscape, java, or sun that is available to JavaScript. </p><p><a href="es/Core_JavaScript_1.5_Reference/Global_Objects/Packages/java">java</a>: Any class in the Java package java.*. </p><p><a href="es/Core_JavaScript_1.5_Reference/Global_Objects/Packages/netscape">netscape</a>: Any class in the Java package netscape.*. </p><p><a href="es/Core_JavaScript_1.5_Reference/Global_Objects/Packages/sun">sun</a>: Any class in the Java package sun.*. +</p> +<h3 id="Examples" name="Examples"> Examples </h3> +<h4 id="Example:_JavaScript_function_to_create_a_Java_dialog_box" name="Example:_JavaScript_function_to_create_a_Java_dialog_box"> Example: JavaScript function to create a Java dialog box </h4> +<p>The following JavaScript function creates a Java dialog box: +</p> +<pre class="eval">function createWindow() { + var theOwner = new Packages.java.awt.Frame(); + var theWindow = new Packages.java.awt.Dialog(theOwner); + theWindow.setSize(350, 200); + theWindow.setTitle("Hello, World"); + theWindow.setVisible(true); +} +</pre> +<p>In the previous example, the function instantiates <code>theWindow</code> as a new <code>Packages</code> object. The <code>setSize</code>, <code>setTitle</code>, and <code>setVisible</code> methods are all available to JavaScript as public methods of <code>java.awt.Dialog</code>. +</p> +<div class="noinclude"> +</div> diff --git a/files/es/archive/web/liveconnect/sun/index.html b/files/es/archive/web/liveconnect/sun/index.html new file mode 100644 index 0000000000..2ded558161 --- /dev/null +++ b/files/es/archive/web/liveconnect/sun/index.html @@ -0,0 +1,17 @@ +--- +title: sun +slug: Archive/Web/LiveConnect/sun +translation_of: Archive/Web/LiveConnect_Reference/sun +--- +<p> </p> +<h3 id="Summary" name="Summary">Sumario</h3> +<p><strong>Objeto Core</strong></p> +<p>Objeto de nivel superior usado para acceder a cualquier clase Java en el paquete <code>sun.*</code>.</p> +<h3 id="Created_by" name="Created_by">Creado por</h3> +<p>El objeto <code>sun</code> es un objeto Javascript predefinido de nivel superior. Puede acceder a él automáticamente sin necesidad de utilizar un constructor o llamar a un método.</p> +<h3 id="Description" name="Description">Descripción</h3> +<p>El objeto <code>sun</code> es un sinónimo de conveniencia de la propiedad <code>Packages.sun</code>.</p> +<h3 id="See_also" name="See_also">Ver también</h3> +<p><a href="/es/Core_JavaScript_1.5_Reference/Global_Objects/Packages" title="es/Core_JavaScript_1.5_Reference/Global_Objects/Packages">Packages</a>, <a href="/es/Core_JavaScript_1.5_Reference/Global_Objects/Packages/sun" title="es/Core_JavaScript_1.5_Reference/Global_Objects/Packages/sun">Packages.sun</a></p> + +<p></p> |