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

Cannot setup Highcharts 5+ with a custom window #7031

Closed
AamuLumi opened this Issue Aug 2, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@AamuLumi

AamuLumi commented Aug 2, 2017

Hi !

I'm using Highcharts to make some server generated charts. Currently, I work with the Highcharts 4.2.6, but due to #5926, I need to work with at least the 5.0.3.

In version 4, Highcharts had the possibility to setup a custom window (created for example with JSDom). In the last version, I cannot setup the custom window because it is erased by the global object window. Here are the first lines of highcharts.src.js :

'use strict';
(function(root, factory) {
    if (typeof module === 'object' && module.exports) {
        module.exports = root.document ?
            factory(root) :
            factory;
    } else {
        root.Highcharts = factory(root);
    }
}(typeof window !== 'undefined' ? window : this, function(win) {
    var Highcharts = (function() {
        /**
         * (c) 2010-2017 Torstein Honsi
         *
         * License: www.highcharts.com/license
         */
        /* global window */
        var win = window, // Custom window is erased
            doc = win.document;

I tested by removing the var win = window line, and it worked.
The problem is I need this to be in the current npm package.

I know these lines come from the Globals.js file and the problematic line is used for front-end generation.

Is there a possibility to solve this for back-end development ?

Thanks a lot for all your job. :)

@KacperMadej

This comment has been minimized.

Show comment
Hide comment
@KacperMadej

KacperMadej Aug 2, 2017

Contributor

@TorsteinHonsi It's hard to see why win is provided as an argument and immediately a new variable of the same name is created basically erasing the argument value. Is there a reason or it's a bug?

Contributor

KacperMadej commented Aug 2, 2017

@TorsteinHonsi It's hard to see why win is provided as an argument and immediately a new variable of the same name is created basically erasing the argument value. Is there a reason or it's a bug?

@AamuLumi

This comment has been minimized.

Show comment
Hide comment
@AamuLumi

AamuLumi Aug 4, 2017

Thanks for the fix ! :)

AamuLumi commented Aug 4, 2017

Thanks for the fix ! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment