dominikh / go-js-dom

MIT License
252 stars 42 forks source link

add requestAnimationFrame and importNode #18

Closed shutej closed 9 years ago

shutej commented 9 years ago

In particular, advice on wrapping the DOMHighResTimeStamp would be helpful?

dominikh commented 9 years ago

I don't think we should add DOMHighResTimeStamp at all. Instead, we should use Go's time.Time -- RequestAnimationFrame should wrap the callback in its own function, that accepts the DOMHighResTimeStamp (as a *js.Object), converts it to a time.Time, and calls the real callback with it.

AddEventListener is a good example of the idea. It takes a js.Object and turns it into an Event, we'd do the same just for js.Object -> time.Time

shutej commented 9 years ago

I think I got this right? PTAL

dominikh commented 9 years ago

Sorry, I didn't realise that the timestamp was relative to the start of the application, not an absolute time. We want to use time.Duration instead of time.Time then. Apart from that, your changes look good.

shutej commented 9 years ago

(I think this fixes duration?)

dominikh commented 9 years ago

Merged as bbbde021f90d13a4ccb948794bf8319b7b5aa337 onwards - thank you..