GopherJS code for a dropped item

58 views
Skip to first unread message

thomas.b...@gmail.com

unread,
May 12, 2016, 11:00:58 AM5/12/16
to GopherJS

Hello,

I am currently converting a JS code into GopherJS. I mostly use the DOM API.

I was wondering how to convert:
ev.dataTransfer.getData('URL');
into GopherJS ?

The event "ev" is triggered while dropping an URL from a Web browser URL bar into a DIV element.

Thanks,

Thomas

Dmitri Shuralyov

unread,
May 12, 2016, 2:41:09 PM5/12/16
to GopherJS
How familiar are you with https://godoc.org/github.com/gopherjs/gopherjs/js package?

You should be able to do the above using:

ev.Get("dataTransfer").Call("getData", "URL")

The event "ev" is triggered while dropping an URL from a Web browser URL bar into a DIV element.

Do you already have an event listener added for that? If not, you'll need to add it.

Thomas Bellembois

unread,
May 13, 2016, 5:09:21 AM5/13/16
to goph...@googlegroups.com

Thanks for your answers.


On 12/05/2016 20:41, Dmitri Shuralyov wrote:
How familiar are you with https://godoc.org/github.com/gopherjs/gopherjs/js package?

You should be able to do the above using:

ev.Get("dataTransfer").Call("getData", "URL")

I am not very familiar with it yet. Thanks to your answers I have made progress but I may have another problem because:
e.(*dom.DragEvent).Get("dataTransfer").Get("items").Get("length")
returns 0


The event "ev" is triggered while dropping an URL from a Web browser URL bar into a DIV element.

Do you already have an event listener added for that? If not, you'll need to add it.

Yes, the event listener works when I drop items (DIVs) from the same page.

On Thursday, May 12, 2016 at 8:00:58 AM UTC-7, thomas.b...@gmail.com wrote:

Hello,

I am currently converting a JS code into GopherJS. I mostly use the DOM API.

I was wondering how to convert:
ev.dataTransfer.getData('URL');
into GopherJS ?

The event "ev" is triggered while dropping an URL from a Web browser URL bar into a DIV element.

Thanks,

Thomas
--
You received this message because you are subscribed to a topic in the Google Groups "GopherJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gopherjs/g8Izg9vioig/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gopherjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages