Skip to content

Fix reference to window object in choropleth code#392

Open
w4 wants to merge 1 commit intomarkmarkoh:masterfrom
JordanForks:master
Open

Fix reference to window object in choropleth code#392
w4 wants to merge 1 commit intomarkmarkoh:masterfrom
JordanForks:master

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