Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reference to window object in choropleth code #392

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

w4
Copy link

@w4 w4 commented May 10, 2017

No description provided.

@w4
Copy link
Author

w4 commented May 11, 2017

If this is affecting anyone else (ie. anyone using CommonJS and the dataUrl config prop), the easiest fix is a monkeypatch.

import * as Datamap from 'datamaps';

...

const originalDraw = Datamap.prototype.draw;
const originalUpdateChoropleth = Datamap.prototype.updateChoropleth;

Datamap.prototype.draw = function () {
    window['Datamaps'] = Datamap;
    originalDraw.call(this);
};

Datamap.prototype.updateChoropleth = function (data, options) {
    delete window['Datamaps'];
    originalUpdateChoropleth.call(this, data, options);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant