beyonk-group / svelte-mapbox

MapBox Map and Autocomplete components for Svelte (or Vanilla JS)
MIT License
342 stars 62 forks source link

Improve Basic Usage (Map) example on readme #13

Closed nfk closed 4 years ago

nfk commented 4 years ago

The basic example is uncompleted and does not expose the event ready, which is a requirement to use the mapComponent.

Maybe a working example in REPL can help the user (I dont know if we can do that)

antony commented 4 years ago

It would need a mapbox key, which isn't something I'd like to expose.

Is ready necessary to use it? It's useful for sure, but I'm not sure about necessary. All events are added to the queue.

Also if you check the project out and run npm run dev there is a working example.

nfk commented 4 years ago

REPL example will be faster, the user could be used its own key or maybe we can reuse the one provided on svelte example.

Here a REPL example about svelte-mapbox which does not work due to NS_ERROR_FAILURE. I did not find a way to solve this issue, maybe this one is related to the REPL context.

Indeed using the ready event is not mandatory but it can be useful. I found it after reading the source code.

BTW the library is very great. thanks for your work.

antony commented 4 years ago

The Svelte example uses it's own key which only works from the Svelte domain. We can't just steal their key.

I don't have a way forward for this right now since I don't want to drop my own key into the examples, so I think the best way for now is just as-it-is, bring-your-own-key.

brendanmatkin commented 3 years ago

FYI that REPL example still doesn't work even with your own key. Probably related to this firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=941146. Some kind of obscure CORS or display:none error for iframes. Should I create a new bug for this? Is supporting a REPL example in scope for this project?

Edit: that bug is super old but there is still activity on it. There are a few related bugs floating around but I think this sums up the problem OK.