diff options
author | Leif Åstrand <leif@vaadin.com> | 2015-10-26 16:13:54 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-11-02 14:45:55 +0000 |
commit | cbc4c878f8b1964552ffce759cef27708f512215 (patch) | |
tree | 8174b2cbf060503d72987b9776a17090cdf0d7f2 /server | |
parent | 3688133b20f55174774191ee434c30465eb1a1b0 (diff) | |
download | vaadin-framework-cbc4c878f8b1964552ffce759cef27708f512215.tar.gz vaadin-framework-cbc4c878f8b1964552ffce759cef27708f512215.zip |
Mention quirks with JavaScript "this" in AbstractJavaScript* javadocs
Change-Id: I512b861c65f8c0f6c6e8f684cb933cbcc20cdb99
Diffstat (limited to 'server')
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 |