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

RequireJS - Gauge is not defined #255

Open
davidhill001 opened this issue Mar 1, 2022 · 0 comments
Open

RequireJS - Gauge is not defined #255

davidhill001 opened this issue Mar 1, 2022 · 0 comments

Comments

@davidhill001
Copy link

I love the look of gauge.js and would love to try it out on one of my projects but I'm really struggling to get it to run when including the JS file via. RequireJS 2.3.6. It just says 'Gauge is not defined':

image

I can see that RequireJS has downloaded and included the JS file but for some reason the Gauge variable just isn't set:

image

image

My require.js configuration:

define('global/window', [], function(){
  return window;
});

define('global/document', ['global/window'], function(window){
  return window.document;
});

requirejs.config({
    appDir: "../",
    baseUrl: "/js",
    paths: {
            'Gauge_js': ['https://bernii.github.io/gauge.js/dist/gauge']
    },
    shim: {
    },    
    map: {
    },    
    attributes: {
       crossorigin: "anonymous"
    }, 
    onNodeCreated: function(node, config, name, url){
      if(config.attributes){
		Object.keys(config.attributes).forEach(function(attribute) {
		  node.setAttribute(attribute, config.attributes[attribute]);
		});
      }
    }
});

require(['Gauge_js'], function($) {
    return {};
});

I have tried the minified version and the full versions from both CDNJS and bernii.github.io.

Please does anyone have any ideas?

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

No branches or pull requests

1 participant