{"action":"created","issue":{"url":"https://api.github.com/repos/derekeder/FusionTable-Map-Template/issues/42","labels_url":"https://api.github.com/repos/derekeder/FusionTable-Map-Template/issues/42/labels{/name}","comments_url":"https://api.github.com/repos/derekeder/FusionTable-Map-Template/issues/42/comments","events_url":"https://api.github.com/repos/derekeder/FusionTable-Map-Template/issues/42/events","html_url":"https://github.com/derekeder/FusionTable-Map-Template/pull/42","id":56564492,"number":42,"title":"Turns MapsLib into a Class","user":{"login":"amenadiel","id":238439,"avatar_url":"https://avatars.githubusercontent.com/u/238439?v=3","gravatar_id":"","url":"https://api.github.com/users/amenadiel","html_url":"https://github.com/amenadiel","followers_url":"https://api.github.com/users/amenadiel/followers","following_url":"https://api.github.com/users/amenadiel/following{/other_user}","gists_url":"https://api.github.com/users/amenadiel/gists{/gist_id}","starred_url":"https://api.github.com/users/amenadiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amenadiel/subscriptions","organizations_url":"https://api.github.com/users/amenadiel/orgs","repos_url":"https://api.github.com/users/amenadiel/repos","events_url":"https://api.github.com/users/amenadiel/events{/privacy}","received_events_url":"https://api.github.com/users/amenadiel/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-04T18:07:07Z","updated_at":"2015-02-11T03:31:00Z","closed_at":"2015-02-11T03:31:00Z","pull_request":{"url":"https://api.github.com/repos/derekeder/FusionTable-Map-Template/pulls/42","html_url":"https://github.com/derekeder/FusionTable-Map-Template/pull/42","diff_url":"https://github.com/derekeder/FusionTable-Map-Template/pull/42.diff","patch_url":"https://github.com/derekeder/FusionTable-Map-Template/pull/42.patch"},"body":"In its current state, MapsLib is an object in the global scope. To invoke its own function type properties, it addresses the global object. When you want to change the API key or the table id, you must either edit the mapslib library or overwrite the default properties of the global object.\r\n\r\nI wanted to encapsulate all the logic in a class, so that you could interact with the MapsLib instance without ever editing the file or operating on the global element. With this you can even create N instances of MapsLib for N maps, if the need came. To instance a new mapslib object, you do\r\n\r\n```js\r\nvar MapsLibInstance = new MapsLib({\r\n              /*fusionTableId:      \"1m4Ez9xyTGfY2CU6O-UgEcPzlS0rnzLU93e4Faa0\",\r\n\r\n              //*New Fusion Tables Requirement* API key. found at https://code.google.com/apis/console/\r\n              //*Important* this key is for demonstration purposes. please register your own.\r\n              googleApiKey:       \"AIzaSyA3FQFrNr5W2OEVmuENqhb2MBB2JabdaOY\",\r\n\r\n              //name of the location column in your Fusion Table.\r\n              //NOTE: if your location column name has spaces in it, surround it with single quotes\r\n              //example: locationColumn:     \"'my location'\",\r\n              locationColumn:     \"geometry\",\r\n\r\n              // latitude and longitude your map will be centered on\r\n              lat : 41.8781136,\r\n              lng : -87.666778,\r\n\r\n              locationScope:      \"chicago\",      //geographical area appended to all address searches\r\n              recordName:         \"result\",       //for showing number of results\r\n              recordNamePlural:   \"results\",\r\n\r\n              searchRadius:       805,            //in meters ~ 1/2 mile\r\n              defaultZoom:        11,             //zoom level when map is loaded (bigger is more zoomed in)\r\n              addrMarkerImage:    'images/blue-pushpin.png', // set to empty '' to hide searched address marker\r\n              currentPinpoint:    null,\r\n            */\r\n            });\r\n```\r\n\r\nthat roughly equals calling the former initialize() method.\r\n\r\nI changed the current examples accordingly, and also included an optional AMD module definition and a index_amd.html file showing the use case with require.js."},"comment":{"url":"https://api.github.com/repos/derekeder/FusionTable-Map-Template/issues/comments/73829180","html_url":"https://github.com/derekeder/FusionTable-Map-Template/pull/42#issuecomment-73829180","issue_url":"https://api.github.com/repos/derekeder/FusionTable-Map-Template/issues/42","id":73829180,"user":{"login":"derekeder","id":919583,"avatar_url":"https://avatars.githubusercontent.com/u/919583?v=3","gravatar_id":"","url":"https://api.github.com/users/derekeder","html_url":"https://github.com/derekeder","followers_url":"https://api.github.com/users/derekeder/followers","following_url":"https://api.github.com/users/derekeder/following{/other_user}","gists_url":"https://api.github.com/users/derekeder/gists{/gist_id}","starred_url":"https://api.github.com/users/derekeder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekeder/subscriptions","organizations_url":"https://api.github.com/users/derekeder/orgs","repos_url":"https://api.github.com/users/derekeder/repos","events_url":"https://api.github.com/users/derekeder/events{/privacy}","received_events_url":"https://api.github.com/users/derekeder/received_events","type":"User","site_admin":false},"created_at":"2015-02-11T03:31:00Z","updated_at":"2015-02-11T03:31:00Z","body":"Working on this in a new pull request #45"}}