Skip to content

Commit

Permalink
Fixed compatibility issues with Node and NW.js.
Browse files Browse the repository at this point in the history
  • Loading branch information
viskin committed May 30, 2015
1 parent b2bdde7 commit 440ef64
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 42 deletions.
6 changes: 2 additions & 4 deletions MarkerWithGhost.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global define,module,require */
/* global define,module,require,google */

(function (root, factory) {
'use strict';
Expand All @@ -7,7 +7,7 @@
define(['jquery', 'SlidingMarker'], factory.bind(null, root));
} else if (typeof module !== "undefined" && module !== null && module.exports != null) { // jshint ignore:line
// Node module.
module.exports = factory(window, require('jquery'), require('SlidingMarker'));
module.exports = factory(root, require('jquery'), require('SlidingMarker'));
} else {
// Browser globals
root.MarkerWithGhost = factory(root, root.jQuery, root.SlidingMarker);
Expand All @@ -16,8 +16,6 @@
function (root, $, SlidingMarker) {
'use strict';

var google = root.google;

//Let jQuery be soft dependency
$ = $ || {};
$.extend = $.extend || function extend(obj) {
Expand Down
39 changes: 26 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,6 @@ This project is one big step towards animated [OverlappingMarkerSpiderfier](http

# Install

## with npm

```
npm install marker-animate-unobtrusive
```

All needed dependencies are in [vendor](https://github.com/terikon/marker-animate-unobtrusive/tree/master/vendor) folder.
These are jquery.easing and markerAnimate.

## with bower

```
Expand Down Expand Up @@ -94,6 +85,29 @@ Note: [jQuery](http://jquery.com/download) is soft dependency, you can prefer no
you should provide [alternative animation routine](#SlidingMarker.options.animateFunctionAdapter), and should not include
jquery.easing and markerAnimate libraries.

All needed dependencies are in [vendor](https://github.com/terikon/marker-animate-unobtrusive/tree/master/vendor) folder.

## with npm

```
npm install marker-animate-unobtrusive
```

The library is compatible with [NW.js](nwjs.io). Use it following way:

```html
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">
global.google = google;
</script>
<script type="text/javascript" src="app.js"></script>
```

```js
var SlidingMarker = require('marker-animate-unobtrusive');
var marker = new SlidingMarker();
```

# Use

## locally
Expand Down Expand Up @@ -128,7 +142,6 @@ var marker = new google.maps.Marker();
marker.setPosition(latLng); //Will cause smooth animation
```


# API

**SlidingMarker** object that inherits google.maps.Marker is created in global scope (on injected with [AMD](#amd)), with following method in it:
Expand Down Expand Up @@ -235,13 +248,13 @@ Geolocation Marker are in [vendor](https://github.com/terikon/marker-animate-uno

marker-animate-unobtrusive can be used with [requirejs](http://requirejs.org/).

'jquery' library should be configured with requirejs. markerAnimate should be configured as well.
'jquery' library should be configured with requirejs. marker-animate should be configured as well.

```js
requirejs.config({
shim: {
"jquery.easing": ["jquery"],
"markerAnimate": { deps: ["jquery.easing"] }
"jquery-easing": ["jquery"],
"marker-animate": { deps: ["jquery-easing"] }
}
});
```
Expand Down
8 changes: 3 additions & 5 deletions SlidingMarker.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* global define,module,require */
/* global define,module,require,google */

(function (root, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery', 'markerAnimate'], factory.bind(null, root));
define(['jquery', 'marker-animate'], factory.bind(null, root));
} else if (typeof module !== "undefined" && module !== null && module.exports != null) { // jshint ignore:line
// Node module.
module.exports = factory(window, require('jquery'));
module.exports = factory(root, require('jquery'), require('marker-animate'));
} else {
// Browser globals
root.SlidingMarker = factory(root, root.jQuery);
Expand All @@ -16,8 +16,6 @@
function (root, $) {
'use strict';

var google = root.google;

//Let jQuery be soft dependency
$ = $ || {};
$.extend = $.extend || function extend(obj) {
Expand Down
8 changes: 4 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "marker-animate-unobtrusive",
"main": "SlidingMarker.js",
"version": "0.2.3",
"version": "0.2.4",
"description": "Unobtrusive Google Maps animated marker",

"homepage": "https://github.com/terikon/marker-animate-unobtrusive",
"authors": [
{ "name": "Terikon Software", "email": "npm@terikon.com", "homepage": "http://il.linkedin.com/in/romanviskin" }
{ "name": "Terikon Software", "email": "npm@terikon.com", "homepage": "http://il.linkedin.com/in/romanviskin" }
],

"moduleType": [
Expand All @@ -22,8 +22,8 @@
"keywords": [
"Google Maps",
"marker",
"marker animation",
"SlidingMarker"
"marker animation",
"SlidingMarker"
],

"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions dist/MarkerWithGhost.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/MarkerWithGhost.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 440ef64

Please sign in to comment.