Skip to content

Commit

Permalink
fix: use named exports instead of default (#411)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This library is now using named exports instead of default.
  • Loading branch information
jpoehnelt committed Jan 5, 2022
1 parent e447f7d commit ab2214b
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,5 @@ $RECYCLE.BIN/

# Windows shortcuts
*.lnk

.vscode
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ or

`yarn add @googlemaps/markerwithlabel`

Alternativly you may add the umd package directly to the html document using the unpkg link.
Alternatively you may add the umd package directly to the html document using the unpkg link.

`<script src="https://unpkg.com/@googlemaps/markerwithlabel/dist/index.min.js"></script>`

When adding via unpkg, the marker with labels can be accessed at `MarkerWithLabel`.
When adding via unpkg, the marker with labels can be accessed at `new markerWithLabel.MarkerWithLabel()`.

A version can be specified by using `https://unpkg.com/@googlemaps/markerwithlabel@VERSION/dist/...`.

Expand All @@ -42,6 +42,8 @@ The reference documentation can be found at this [link](https://googlemaps.githu
## Example

```js
import { MarkerWithLabel } from '@googlemaps/markerwithlabel';

new MarkerWithLabel({
position: new google.maps.LatLng(49.475, -123.84),
clickable: true,
Expand Down
4 changes: 2 additions & 2 deletions examples/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
mapTypeId: google.maps.MapTypeId.ROADMAP,
});

var marker1 = new MarkerWithLabel({
var marker1 = new markerWithLabel.MarkerWithLabel({
position: homeLatLng,
draggable: false,
clickable: false,
Expand All @@ -58,7 +58,7 @@
labelStyle: { opacity: 0.75 },
});

var marker2 = new MarkerWithLabel({
var marker2 = new markerWithLabel.MarkerWithLabel({
position: new google.maps.LatLng(49.475, -123.84),
draggable: true,
map: map,
Expand Down
2 changes: 1 addition & 1 deletion examples/events.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
mapTypeId: google.maps.MapTypeId.ROADMAP,
});

var marker = new MarkerWithLabel({
var marker = new markerWithLabel.MarkerWithLabel({
position: homeLatLng,
draggable: true,
raiseOnDrag: true,
Expand Down
2 changes: 1 addition & 1 deletion examples/lettered.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
mapTypeId: google.maps.MapTypeId.ROADMAP,
});

marker = new MarkerWithLabel({
marker = new markerWithLabel.MarkerWithLabel({
position: homeLatLng,
map: map,
draggable: true,
Expand Down
2 changes: 1 addition & 1 deletion examples/picturelabel.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
pictureLabel = document.createElement("img");
pictureLabel.src = "home.jpg";

marker = new MarkerWithLabel({
marker = new markerWithLabel.MarkerWithLabel({
position: homeLatLng,
map: map,
draggable: true,
Expand Down
9 changes: 3 additions & 6 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,13 @@ export default [
file: "dist/index.umd.js",
format: "umd",
sourcemap: true,
exports: "default",
name: "MarkerWithLabel",
name: "markerWithLabel",
},
{
file: "dist/index.min.js",
format: "iife",
sourcemap: true,
exports: "default",
name: "MarkerWithLabel",
name: "markerWithLabel",
},
],
},
Expand All @@ -62,7 +60,7 @@ export default [
output: {
file: "dist/index.dev.js",
format: "iife",
name: "MarkerWithLabel",
name: "markerWithLabel",
},
},
{
Expand All @@ -74,7 +72,6 @@ export default [
file: "dist/index.esm.js",
format: "esm",
sourcemap: true,
name: "MarkerWithLabel",
},
},
];
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
* limitations under the License.
*/

import { MarkerWithLabel } from "./marker";
import { MarkerWithLabel, MarkerWithLabelOptions } from "./marker";

export default MarkerWithLabel;
export { MarkerWithLabel, MarkerWithLabelOptions };

0 comments on commit ab2214b

Please sign in to comment.