Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoji Chen committed Apr 5, 2019
1 parent 4963570 commit 50c22a2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
9 changes: 4 additions & 5 deletions examples/get-started/pure-js-google-maps/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import {GeoJsonLayer} from '@deck.gl/layers';
const GEOJSON =
'https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_110m_admin_1_states_provinces_shp.geojson'; //eslint-disable-line

// Retrieving GOOGLE_MAPS_API_KEY from the environment variable
const gmUrl = `https://maps.googleapis.com/maps/api/js?key=${
process.env.GOOGLE_MAPS_API_KEY // eslint-disable-line
}&libraries=visualization&v=3.34`;
// Set your Google Maps API key here or via environment variable
const GOOGLE_MAPS_API_KEY = process.env.GoogleMapsAPIKey; // eslint-disable-line
const GOOGLE_MAPS_API_URL = `https://maps.googleapis.com/maps/api/js?key=${GOOGLE_MAPS_API_KEY}&libraries=visualization&v=3.34`;

function loadScript(url) {
const script = document.createElement('script');
Expand All @@ -22,7 +21,7 @@ function loadScript(url) {
});
}

loadScript(gmUrl).then(() => {
loadScript(GOOGLE_MAPS_API_URL).then(() => {
const map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 40, lng: -100},
zoom: 4
Expand Down
6 changes: 2 additions & 4 deletions examples/get-started/pure-js-google-maps/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
// NOTE: To use this example standalone (e.g. outside of deck.gl repo)
// delete the local development overrides at the bottom of this file

// avoid destructuring for older Node version support
const resolve = require('path').resolve;
const webpack = require('webpack');

const CONFIG = {
mode: 'development',

entry: {
app: resolve('./app.js')
app: './app.js'
},

plugins: [
// Read google maps token from environment variable
new webpack.EnvironmentPlugin(['GOOGLE_MAPS_API_KEY'])
new webpack.EnvironmentPlugin(['GoogleMapsAPIKey'])
]
};

Expand Down
5 changes: 2 additions & 3 deletions examples/get-started/pure-js-mapbox/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// NOTE: To use this example standalone (e.g. outside of deck.gl repo)
// delete the local development overrides at the bottom of this file

// avoid destructuring for older Node version support
const resolve = require('path').resolve;
const {resolve} = require('path');
const webpack = require('webpack');

const CONFIG = {
mode: 'development',

entry: {
app: resolve('./app.js')
app: './app.js'
},

resolve: {
Expand Down
4 changes: 2 additions & 2 deletions examples/get-started/pure-js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const deck = new Deck({
filled: true,
lineWidthMinPixels: 2,
opacity: 0.4,
getLineColor: () => [255, 100, 100],
getFillColor: () => [200, 160, 0, 180]
getLineColor: [255, 100, 100],
getFillColor: [200, 160, 0, 180]
})
]
});
Expand Down
4 changes: 1 addition & 3 deletions examples/get-started/pure-js/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
// NOTE: To use this example standalone (e.g. outside of deck.gl repo)
// delete the local development overrides at the bottom of this file

// avoid destructuring for older Node version support
const resolve = require('path').resolve;
const HtmlWebpackPlugin = require('html-webpack-plugin');

const CONFIG = {
mode: 'development',

entry: {
app: resolve('./app.js')
app: './app.js'
},

plugins: [new HtmlWebpackPlugin({title: 'deck.gl example'})]
Expand Down

0 comments on commit 50c22a2

Please sign in to comment.