terikon / marker-animate-unobtrusive

Google Maps markers become animated, unobtrusively

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using marker-animate-unobtrusive with nw.js

quentinlampin opened this issue · comments

Hello there,

I'm trying to require marker-animate-unobtrusive in a nw.js application.
The require('marker-animate-unobtrusive') step returns the error:

"Uncaught ReferenceError: google is not defined" (in [...]/SlidingMarker.js, line 42)

I'm a Javascript novice so this is likely a fault in my code but it might as well be not so...
here is a gist that reproduces the error: https://gist.github.com/320d41498cbbe911bc97.git

Regards,

Quentin

I'll have a look

My bad, never heard before about nw.js, so never actually tested the node.js support.
I fixed the bug in the library, so it will support nw.js starting with 0.2.3. Please update your reference.
I fixed few minor issues in your code, please review them here: https://gist.github.com/viskin/370b3c563d209ba8ee44
Thanks a lot for finding the issue and helping to fix it with your gist.
Please tell me if the issue is actually fixed.

Hey viskin,
I updated (actually forked/modified) the gist to further test
marker-animate-unobtrusive with NW.js.

Unfortunately, there are still a few broken features.
Here is an updated gist : https://gist.github.com/6dc92bc43d345d654974.git

This updated app.js add an onclick event listener to the slidingMarker.
When clicking on the sliding marker, an "Uncaught TypeError: Cannot read
property 'call' of undefined" exception fires up.

I've tested the same behaviour on the non-sliding marker, it worked.

Thanks for your time, much appreciated!

Quentin

2015-05-29 17:00 GMT+02:00 viskin notifications@github.com:

My bad, never heard before about nw.js, so never actually tested the
node.js support.
I fixed the bug in the library, so it will support nw.js starting with
0.2.3. Please update your reference.
I fixed few minor issues in your code, please review them here:
https://gist.github.com/viskin/370b3c563d209ba8ee44
Thanks a lot for finding the issue and helping to fix it with your gist.
Please tell me if the issue is actually fixed.


Reply to this email directly or view it on GitHub
#4 (comment)
.

Quentin Lampin

You're right, I have more work to do for node support.
First of all, here's quick dirty hack to resolve your issue: https://gist.github.com/viskin/a3dcb347ceaa03a90e2a
2. I will add more friendly error for situation you just run into.
3. The problem is that marker-animate-unobtrusive itself does not provide animation routine, it just wraps one so it will be kind-of invisible for you (just use Google Maps and it works). By default the library relies on marker-animate which AFAIK is not so friendly to node environment. This is the piece you are now missing.

You can use my hack for a while, and I will try to create a fork of marker-animate that is node-friendly, after which the hack will not be needed.

I managed the issue by providing node wrappers for marker-animate and jquery-easing libraries.
Now all the needed references are loaded automatically so you don't need to worry about them.
See latest version of working app is here: https://gist.github.com/viskin/a3dcb347ceaa03a90e2a
Also updated README with NW.js-related explanation.
The only thing still needed to do in index.html is to make google object global.

Does it work for you?

Hey, l will give it a try on monday.
Thanks for being so quick at fixing those issues !

Sorry for the delay, I finally had time to test the latest version and it
does work. Well done!
I wonder if it would be possible to get rid of :

<script type="text/javascript"> global.google = google;</script>

I'm pretty sure I would totally forget the reason of this piece of code if
it weren't for the comment that link to this discussion ;). Anyways, that's
nit-picking.

Thanks again for solving this!

Quentin

2015-05-30 20:42 GMT+02:00 Quentin Lampin quentin.lampin@gmail.com:

Hey, l will give it a try on monday.
Thanks for being so quick at fixing those issues !

I managed the issue by providing node wrappers for marker-animate and
jquery-easing libraries.
Now all the needed references are loaded automatically so you don't need
to worry about them.
See latest version of working app is here:
https://gist.github.com/viskin/a3dcb347ceaa03a90e2a
Also updated README with NW.js-related explanation.
The only thing still needed to do in index.html is to make google object
global.

Does it work for you?


Reply to this email directly or view it on GitHub
#4 (comment)
.

Quentin Lampin

Great.
As for getting rid if global google... I'm not sure, but there should exist node wrapper for Google Maps, that will provide google object as node module.

HI Viskin,

I'm facing this same problem in C#/ASP.NET. I'm also a novice.
image