Using the Kongregate API with JavaScript

  • There are existing solutions to loading the Kongregate API already, like using Execute Javascript calls and loading the API from an exported HTML file, but it would be much more convenient to load the API directly from JavaScript.

    I've done two things to try and make this work. I have this code as a separate main.js file:

    runOnStartup(async runtime => {
    	kongregateAPI.loadAPI(() => {
    		globalThis.kongregate = kongregateAPI.getAPI();
    		alert("Kongregate API successfully loaded!");
    	});
    });
    

    And I've also tried loading the Kongregate API by copying the contents of that file into a new script. However, this causes a syntax error, if I understand correctly this is because of the automatic strict mode.

    Is there a way to achieve this with JavaScript alone?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)