From 6ed87c26c1fb8680829a404c62ce5291797f93ce Mon Sep 17 00:00:00 2001 From: Colin Alworth Date: Wed, 15 Jan 2020 11:55:50 -0600 Subject: [PATCH] Small changes to make j2cl and closure happier with this lib --- .../axellience/vuegwt/core/client/VueGWT.js | 4 ++-- .../client/customelement/VueCustomElement.js | 21 +++++++++++++++++++ .../customelement/VueCustomElementType.java | 11 ++++++---- 3 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 core/src/main/java/com/axellience/vuegwt/core/client/customelement/VueCustomElement.js diff --git a/core/src/main/java/com/axellience/vuegwt/core/client/VueGWT.js b/core/src/main/java/com/axellience/vuegwt/core/client/VueGWT.js index f9870433..514a7c61 100644 --- a/core/src/main/java/com/axellience/vuegwt/core/client/VueGWT.js +++ b/core/src/main/java/com/axellience/vuegwt/core/client/VueGWT.js @@ -1,7 +1,7 @@ goog.provide("vuegwt"); /** @define {string} */ -goog.define("vuegwt.environment", "production"); +vuegwt.environment = goog.define("vuegwt.environment", "production"); /** @define {string} */ -goog.define("superdevmode", "off"); \ No newline at end of file +var superdevmode = goog.define("superdevmode", "off"); \ No newline at end of file diff --git a/core/src/main/java/com/axellience/vuegwt/core/client/customelement/VueCustomElement.js b/core/src/main/java/com/axellience/vuegwt/core/client/customelement/VueCustomElement.js new file mode 100644 index 00000000..f5f5b068 --- /dev/null +++ b/core/src/main/java/com/axellience/vuegwt/core/client/customelement/VueCustomElement.js @@ -0,0 +1,21 @@ +/** + * @externs + */ +var VueCustomElement = {}; +/** + * + * @param {Object} param + * @return {Element} + */ +VueCustomElement.createElement = function(param) {}; + +/** + * @type {Object} + */ +Element.prototype.__vue_custom_element__; + +/** + * @param {Object} param + * @return {Function} + */ +Function.prototype.extend = function(param) {}; \ No newline at end of file diff --git a/core/src/main/java/com/axellience/vuegwt/core/client/customelement/VueCustomElementType.java b/core/src/main/java/com/axellience/vuegwt/core/client/customelement/VueCustomElementType.java index b2f258b4..953986d0 100644 --- a/core/src/main/java/com/axellience/vuegwt/core/client/customelement/VueCustomElementType.java +++ b/core/src/main/java/com/axellience/vuegwt/core/client/customelement/VueCustomElementType.java @@ -10,10 +10,13 @@ public class VueCustomElementType { @JsOverlay public final VueCustomElement create() { - return createElement(this); + return VCE.createElement(this); } - @JsMethod(namespace = "VueCustomElement") - private native static VueCustomElement createElement( - VueCustomElementType type); + @JsType(isNative = true, namespace = "", name = "VueCustomElement") + private static final class VCE { + @JsMethod + private native static VueCustomElement createElement( + VueCustomElementType type); + } }