palmstonegames / polymer Goto Github PK
View Code? Open in Web Editor NEWPolymer bindings for GopherJS
License: Apache License 2.0
Polymer bindings for GopherJS
License: Apache License 2.0
The code.palmstonegames.com SSL cert is expired, which is causing go get
for this package to fail.
user@e2c5a1e9cd1a:~$ go get -u -v code.palmstonegames.com/polymer
Fetching https://code.palmstonegames.com/polymer?go-get=1
https fetch failed: Get https://code.palmstonegames.com/polymer?go-get=1: x509: certificate has expired or is not yet valid
package code.palmstonegames.com/polymer: unrecognized import path "code.palmstonegames.com/polymer" (https fetch: Get https://code.palmstonegames.com/polymer?go-get=1: x509: certificate has expired or is not yet valid)
https://github.com/PalmStoneGames/polymer/blob/master/examples/template-dom-bind/main.go#L33
main.go:33:82: cannot use data (variable of type *Data) as code.palmstonegames.com/polymer.BindInterface value in argument to polymer.GetDocument().GetElementByID("tmpl").(*polymer.AutoBindGoTemplate).Bind: wrong type for method Notify
Using GopherJS version
GopherJS 1.7-1
If a TagName doesn't contain a dash ( -
), then Polymer will panic. Polymer however does not mention that this is why it panics.
Due to a combination of multiple factors, working with slices of primitives is very very clunky right now. A pass should be done to try and make things easier to work with.
Related polymer issue: Polymer/polymer#1913
I am not sure if this is a bug, if I am doing something wrong or what. In my changes to one of the examples below, I am trying to trigger an event when the submit button is clicked. However, I get the following error:
Uncaught ReferenceError: handleSubmitClick is not defined
diff --git a/examples/databind-event-callback/main.go b/examples/databind-event-callback/main.go
index f9fb5aa..d9b7133 100644
--- a/examples/databind-event-callback/main.go
+++ b/examples/databind-event-callback/main.go
@@ -34,4 +34,10 @@ func (n *NameTag) HandleNameChange(e *polymer.Event) {
})
}
+func (n *NameTag) HandleSubmitClick(e *polymer.Event) {
+ polymer.Async(1, func() {
+ polymer.Log("Submit clicked")
+ })
+}
+
func main() {}
diff --git a/examples/databind-event-callback/name-tag.html b/examples/databind-event-callback/name-tag.html
index 2ec151b..ce36d90 100644
--- a/examples/databind-event-callback/name-tag.html
+++ b/examples/databind-event-callback/name-tag.html
@@ -15,6 +15,7 @@
The go code bound to it will output the name to the console using fmt.Printf. See main.go.<br />
Each name-tag element is also completely independent, backed by a different instance of the NameTag structure<br />
The Go generated ID of this particular name tag is <b>{{id}}</b>
+ Name: <input type="submit" onclick="handleSubmitClick" /><br />
</template>
<script>PolymerGo("name-tag")</script>
-</dom-module>
\ No newline at end of file
+</dom-module>
I get the same error when I try to use a property change event like this:
<child-component timer-value="{{timerValue}}" on-timer-value-changed="handleTimerValueChanged"></child-component>
However, if I do this in the Created function, it works:
func (c *ChildComponent) Created() {
c.This().Call("addEventListener", "timer-value-changed", c.HandleTimerValueChanged)
}
The databind-struct
example raises this error, below. Similar errors are raised in the notify
and computed-property
examples. The other examples run just fine, even though they also use Notify()
, and I haven't figured out why.
Uncaught TypeError: Cannot read property 'testStruct' of undefined
at HTMLElement._propertySetter (polymer.html:formatted:1405)
at HTMLElement.setter (polymer.html:formatted:1495)
at HTMLElement.set (polymer.html:formatted:2154)
at Object.$packages.github.com/PalmStoneGames/polymer.BY.ptr.doNotify (proto.go:87)
at Object.$packages.github.com/PalmStoneGames/polymer.BY.ptr.Notify (proto.go:82)
at $b (main.go:30)
at $goroutine (databind-struct.js:4)
at $runScheduled (databind-struct.js:4)
at $schedule (databind-struct.js:4)
at $go (databind-struct.js:4)
at Object.$packages.github.com/PalmStoneGames/polymer/examples/databind-struct.D.ptr.Created (main.go:24)
at $b (callbacks.go:62)
at HTMLElement.created (databind-struct.js:4)
at HTMLElement.__initialize (polymer-micro.html:232)
at HTMLElement.createdCallback (polymer-micro.html:217)
at window.Polymer (polymer-micro.html:62)
at CN (register.go:240)
at CM (register.go:202)
at v.$externalizeWrapper (databind-struct.js:4)
at webcomponents-lite.min.js:12
My versions:
The integration of go-polymer with goa is looking great.
It would be nice if we could pass a slice of strings to Notify() , so we could just pass along a collection of them to update at the end of each function.
The regexp package in js.go isn't being used. by removing it, I reduced my generated js code by about 25 percent. As a side note, if you refactor out the fmt package, you can reduce it by an extra 15% or so.
Before:
gopherjs build: 1944768
gopherjs build -m: 1323920
gopherjs build -m gzipped: 250851
After:
gopherjs build: 1455297 -25.2%
gopherjs build -m: 1003977 -24.2%
gopherjs build -m gzipped: 187357 -25.3%
diff --git a/js.go b/js.go
index dfc727d..03f5c6f 100644
--- a/js.go
+++ b/js.go
@@ -18,23 +18,12 @@ package polymer
import (
"reflect"
- "regexp"
"time"
"unicode"
"github.com/gopherjs/gopherjs/js"
)
-var propertyEventNameRegExp *regexp.Regexp
-
-func init() {
- var err error
- propertyEventNameRegExp, err = regexp.Compile("([a-z])([A-Z])")
- if err != nil {
- panic(err)
- }
-}
-
const DateTimeLocalFormat = "2006-01-02T15:04:05"
// DateTimeLocal is a time.Time that properly encodes and decodes to the format expected datetime-local input fields
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.