samvelraja / google-maps-addon Goto Github PK
View Code? Open in Web Editor NEWSimple Wrapper around google maps for simpler ember addon usage
License: MIT License
Simple Wrapper around google maps for simpler ember addon usage
License: MIT License
Currently the user has to inject the google maps SDK manually before using this addon. It would be great if it could be handled by the addon. In my project I'm using the following helper that I borrowed from some other ember google maps addon:
import Ember from 'ember';
const API_KEY = 'xxxxxxxxtheapikeyxxxxxx';
const LIBRARIES = ['drawing'];
var promise;
/**
* Loads the google map SDK
*
* @return {Ember.RSVP.Promise}
*/
export function loadGoogleMaps(resolveWith) {
if (window.google && window.google.maps) {
return Ember.RSVP.resolve(resolveWith);
}
if (promise) {
return promise;
}
var src = `https://maps.googleapis.com/maps/api/js?key=${API_KEY}&libraries=${LIBRARIES.join(",")}`;
return promise = new Ember.RSVP.Promise(function (resolve, reject) {
window.__emberGoogleMapLoaded__ = Ember.run.bind(function () {
promise = null;
window.__emberGoogleMapLoaded__ = null;
resolve(resolveWith);
});
Ember.$.getScript(src + '&callback=__emberGoogleMapLoaded__').fail(function (jqXhr) {
promise = null;
window.__emberGoogleMapLoaded__ = null;
reject(jqXhr);
});
});
}
export default Ember.Helper.helper(loadGoogleMaps);
Hi,
I would love to help out with this repo and addon. What do you think about making me an owner/contributor as well so we can iterate quickly?
Adding polygons the same way we add circles, rectangles and infowindows seems like a no brainer. If I get some time today I might make a PR for it.
@erkie your thoughts?
Republish this new package on npm, becouse when i run "ember install google-maps-addon" then install old packages. (for new I must run 'ember install ember install https://github.com/SamvelRaja/google-maps-addon')
If a shape is added, then removed in a quick succession (I think within the limit for the adding options.timeout
~10ms), a shape will linger on the screen.
@SamvelRaja I noticed the ember-cli-version and some other dependencies are a bit out of date. Do you see any downsides to upgrading them?
Since the mapOptions
is an observable property, when we use the addon in an component, this forces us to create the mapOptions
object has mutable object to handle the CB function, therefore, any changes happened in the component property itself creates the mapOptions
to update.
say,
converting the mapMessage from mousemove to
mouseout triggers back the the component to re-render
Must find a fix ASAP.
One thought is to move-out the CB properties out of mapOptions and providing them as seperate options.
Goal, should not revert back the observer since it is a good enhancement.
@erkie your thoughts are welcome.
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.