Skip to content

Commit 578a01b

Browse files
committed
Merge branch 'master' into JS_RC
2 parents 67ba87a + ad7db0c commit 578a01b

File tree

2 files changed

+65
-5
lines changed

2 files changed

+65
-5
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* This code was generated with Vaadin Web Component GWT API Generator,
3+
* from vaadin-pouchdb project by Manolo Carrasco Moñino
4+
* that is licensed with Apache license.
5+
*/
6+
package com.vaadin.polymer.elemental;
7+
8+
import com.vaadin.polymer.elemental.*;
9+
import com.google.gwt.core.client.JavaScriptObject;
10+
import com.google.gwt.core.client.JsArray;
11+
import jsinterop.annotations.JsOverlay;
12+
import jsinterop.annotations.JsProperty;
13+
import jsinterop.annotations.JsType;
14+
15+
16+
/**
17+
*
18+
*/
19+
@JsType(isNative=true)
20+
@com.google.gwt.core.client.js.JsType
21+
public interface Promise {
22+
23+
@JsOverlay public static final String NAME = "Promise";
24+
@JsOverlay public static final String SRC = "vaadin-pouchdb/sample.html";
25+
26+
27+
28+
/**
29+
*
30+
*
31+
* JavaScript Info:
32+
* @method on
33+
* @param {Function} func
34+
*
35+
*
36+
*/
37+
void on(Function func);
38+
39+
/**
40+
*
41+
*
42+
* JavaScript Info:
43+
* @method then
44+
* @param {Function} func
45+
*
46+
*
47+
*/
48+
void then(Function func);
49+
50+
}

template/helpers.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ module.exports = {
1313
javaKeywords: ['for', 'switch'], // TODO: if it's necessary add other keywords as well
1414
findBehavior: function(name) {
1515
for (var i = 0; name && i < global.parsed.length; i++) {
16-
if (this.className(global.parsed[i].is) == this.className(name)) {
16+
var item = global.parsed[i];
17+
if (this.isBehavior(item) && this.className(item.is) == this.className(name)) {
18+
return global.parsed[i];
19+
}
20+
}
21+
},
22+
findElement: function(name) {
23+
for (var i = 0; name && i < global.parsed.length; i++) {
24+
var item = global.parsed[i];
25+
if (!this.isBehavior(item) && this.className(item.is) == this.className(name)) {
1726
return global.parsed[i];
1827
}
1928
}
@@ -104,10 +113,11 @@ module.exports = {
104113
if (/^element/i.test(t)) return 'Element';
105114
if (/^number/i.test(t)) return 'double';
106115
if (/^function/i.test(t)) return 'Function';
107-
var b = this.findBehavior(t);
108-
if (b) {
109-
var c = this.camelCase(t);
110-
return c != t ? c + 'Element' : c;
116+
if (this.findBehavior(t)) {
117+
return this.camelCase(t);
118+
}
119+
if (this.findElement(t)) {
120+
return this.camelCase(t) + 'Element';
111121
}
112122

113123
return "JavaScriptObject";

0 commit comments

Comments
 (0)