diff options
author | Leif Ã…strand <leif@vaadin.com> | 2015-10-26 16:13:54 +0000 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2015-11-04 13:38:49 +0200 |
commit | c3ebc0139553f0fcf5bf8acbf469d6c5415144a0 (patch) | |
tree | 94d837b0f2ff0b79344965aa51deff1e2ddf29e8 | |
parent | 33936feb9fddc422948296c6eb1df8085cf6657b (diff) | |
download | vaadin-framework-c3ebc0139553f0fcf5bf8acbf469d6c5415144a0.tar.gz vaadin-framework-c3ebc0139553f0fcf5bf8acbf469d6c5415144a0.zip |
Mention quirks with JavaScript "this" in AbstractJavaScript* javadocs
Change-Id: I512b861c65f8c0f6c6e8f684cb933cbcc20cdb99
3 files changed, 16 insertions, 6 deletions
diff --git a/server/src/com/vaadin/server/AbstractJavaScriptExtension.java b/server/src/com/vaadin/server/AbstractJavaScriptExtension.java index 693f3a28c8..2fb50fe7dd 100644 --- a/server/src/com/vaadin/server/AbstractJavaScriptExtension.java +++ b/server/src/com/vaadin/server/AbstractJavaScriptExtension.java @@ -41,8 +41,11 @@ import elemental.json.JsonValue; * <p> * * The initialization function will be called with <code>this</code> pointing to - * a connector wrapper object providing integration to Vaadin with the following - * functions: + * a connector wrapper object providing integration to Vaadin. Please note that + * in JavaScript, <code>this</code> is not necessarily defined inside callback + * functions and it might therefore be necessary to assign the reference to a + * separate variable, e.g. <code>var self = this;</code>. The following + * functions are provided by the connector wrapper object: * <ul> * <li><code>getConnectorId()</code> - returns a string with the id of the * connector.</li> diff --git a/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java b/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java index 4463a6ee61..68ff947137 100644 --- a/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java +++ b/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java @@ -45,8 +45,11 @@ import elemental.json.JsonValue; * own user interface. * <p> * The initialization function will be called with <code>this</code> pointing to - * a connector wrapper object providing integration to Vaadin with the following - * functions: + * a connector wrapper object providing integration to Vaadin. Please note that + * in JavaScript, <code>this</code> is not necessarily defined inside callback + * functions and it might therefore be necessary to assign the reference to a + * separate variable, e.g. <code>var self = this;</code>. The following + * functions are provided by the connector wrapper object: * <ul> * <li><code>getConnectorId()</code> - returns a string with the id of the * connector.</li> diff --git a/server/src/com/vaadin/ui/renderers/AbstractJavaScriptRenderer.java b/server/src/com/vaadin/ui/renderers/AbstractJavaScriptRenderer.java index 66d501eb3f..91a5c0ea45 100644 --- a/server/src/com/vaadin/ui/renderers/AbstractJavaScriptRenderer.java +++ b/server/src/com/vaadin/ui/renderers/AbstractJavaScriptRenderer.java @@ -48,8 +48,12 @@ import elemental.json.JsonValue; * functionality specific for renderers. * <p> * The initialization function will be called with <code>this</code> pointing to - * a connector wrapper object providing integration to Vaadin with the following - * functions: + * a connector wrapper object providing integration to Vaadin. Please note that + * in JavaScript, <code>this</code> is not necessarily defined inside callback + * functions and it might therefore be necessary to assign the reference to a + * separate variable, e.g. <code>var self = this;</code>. In addition to the + * extension functions described for {@link AbstractJavaScriptExtension}, the + * connector wrapper object also provides this function: * <ul> * <li><code>getRowKey(rowIndex)</code> - Gets a unique identifier for the row * at the given index. This identifier can be used on the server to retrieve the |