Browse Source

Use pure JS instead of JQuery JS for Atmosphere (#19396)

Change-Id: I28ba6a808fda7f018cd5f8c483b34aaf3d4b610f
feature/atmosphere-pure-javascript
Artur Signell 8 years ago
parent
commit
177c7cb21c

+ 3
- 4
client/src/main/java/com/vaadin/client/ApplicationConfiguration.java View File

@@ -191,10 +191,9 @@ public class ApplicationConfiguration implements EntryPoint {
*/
private native String getAtmosphereJSVersion()
/*-{
if ($wnd.jQueryVaadin != undefined){
return $wnd.jQueryVaadin.atmosphere.version;
}
else {
if ($wnd.vaadinPush && $wnd.vaadinPush.atmosphere) {
return $wnd.vaadinPush.atmosphere.version;
} else {
return null;
}
}-*/;

+ 3
- 3
client/src/main/java/com/vaadin/client/communication/AtmospherePushConnection.java View File

@@ -556,7 +556,7 @@ public class AtmospherePushConnection implements PushConnection {
self.@com.vaadin.client.communication.AtmospherePushConnection::onClientTimeout(*)(request);
});

return $wnd.jQueryVaadin.atmosphere.subscribe(config);
return $wnd.vaadinPush.atmosphere.subscribe(config);
}-*/;

private native void doPush(JavaScriptObject socket, String message)
@@ -566,12 +566,12 @@ public class AtmospherePushConnection implements PushConnection {

private static native void doDisconnect(String url)
/*-{
$wnd.jQueryVaadin.atmosphere.unsubscribeUrl(url);
$wnd.vaadinPush.atmosphere.unsubscribeUrl(url);
}-*/;

private static native boolean isAtmosphereLoaded()
/*-{
return $wnd.jQueryVaadin != undefined;
return $wnd.vaadinPush && $wnd.vaadinPush.atmosphere;
}-*/;

private void runWhenAtmosphereLoaded(final Command command) {

+ 1
- 1
pom.xml View File

@@ -42,7 +42,7 @@
<!-- Atmosphere versions -->
<!-- Note that this should be kept in sync with the class Constants -->
<atmosphere.runtime.version>2.2.9.vaadin2</atmosphere.runtime.version>
<atmosphere.js.version>2.2.13.vaadin3</atmosphere.js.version>
<atmosphere.js.version>2.2.13.vaadin5</atmosphere.js.version>

<!-- Dependency unpack directory -->
<dependency.unpack.directory>${project.build.directory}/dependency-unpack</dependency.unpack.directory>

+ 8
- 11
push/pom.xml View File

@@ -26,7 +26,7 @@
</dependency>
<dependency>
<groupId>com.vaadin.external.atmosphere.client</groupId>
<artifactId>jquery</artifactId>
<artifactId>javascript</artifactId>
<version>${atmosphere.js.version}</version>
<type>war</type>
<scope>provided</scope>
@@ -48,7 +48,7 @@
<!-- <inherited>false</inherited> -->
<configuration>
<target>
<property name="jquery.unpack" location="${project.build.directory}/temp" />
<property name="javascript.unpack" location="${project.build.directory}/temp" />
<property name="vaadinPush.js"
location="${project.build.outputDirectory}/VAADIN/vaadinPush.debug.js" />
<property name="templates.dir"
@@ -56,24 +56,21 @@

<!-- Unzip to temp dir -->
<unzip
src="${maven.dependency.com.vaadin.external.atmosphere.client.jquery.war.path}"
dest="${jquery.unpack}">
src="${maven.dependency.com.vaadin.external.atmosphere.client.javascript.war.path}"
dest="${javascript.unpack}">
<patternset>
<include name="**/jquery.atmosphere.js" />
<include name="**/atmosphere.js" />
</patternset>
<mapper type="flatten" />
</unzip>
<loadfile srcfile="${templates.dir}/jquery-1.11.0.js"
property="jquery.js.contents" />
<loadfile srcfile="${jquery.unpack}/jquery.atmosphere.js"
property="jquery.atmosphere.js.contents" />
<loadfile srcfile="${javascript.unpack}/atmosphere.js"
property="atmosphere.js.contents" />

<loadfile srcfile="${templates.dir}/vaadinPush.js.tpl"
property="vaadinPush.js.contents">
<filterchain>
<replacetokens begintoken="@" endtoken="@">
<token key="jquery.js" value="${jquery.js.contents}" />
<token key="jquery.atmosphere.js" value="${jquery.atmosphere.js.contents}" />
<token key="atmosphere.js" value="${atmosphere.js.contents}" />
</replacetokens>
</filterchain>
</loadfile>

+ 0
- 10337
push/src/main/templates/jquery-1.11.0.js
File diff suppressed because it is too large
View File


+ 3
- 6
push/src/main/templates/vaadinPush.js.tpl View File

@@ -1,10 +1,7 @@
window.vaadinPush = window.vaadinPush|| {};
(function(define) {
@jquery.js@
window.jQueryVaadin = window.jQuery.noConflict(true);
(function(jQuery, undefined) {
@jquery.atmosphere.js@
})(jQueryVaadin);
@atmosphere.js@
if (window.console) {
window.console.log("Vaadin push loaded");
}
})();
}).call(window.vaadinPush);

+ 4
- 4
uitest/src/test/java/com/vaadin/tests/debug/PushVersionInfoTest.java View File

@@ -25,7 +25,7 @@ import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;

import com.vaadin.testbench.parallel.TestCategory;
import com.vaadin.tests.tb3.MultiBrowserTest;
import com.vaadin.tests.tb3.SingleBrowserTest;

/**
* Test for PUSH version string in debug window.
@@ -33,7 +33,7 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
* @author Vaadin Ltd
*/
@TestCategory("push")
public class PushVersionInfoTest extends MultiBrowserTest {
public class PushVersionInfoTest extends SingleBrowserTest {

@Test
public void testDisabledPush() {
@@ -63,8 +63,8 @@ public class PushVersionInfoTest extends MultiBrowserTest {
"Push client version doesn't contain 'vaadin' string",
jsString.contains("vaadin"));
Assert.assertTrue(
"Push client version doesn't contain 'jquery' string",
jsString.contains("jquery"));
"Push client version doesn't contain 'javascript' string",
jsString.contains("javascript"));
}

private void selectInfoTab() {

Loading…
Cancel
Save