Skip to content

Instantly share code, notes, and snippets.

@ligee
Created December 20, 2016 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ligee/50d30ad9bca5ea925ff7d913ff232004 to your computer and use it in GitHub Desktop.
Save ligee/50d30ad9bca5ea925ff7d913ff232004 to your computer and use it in GitHub Desktop.
sample kotlin js output for 1.1-M04 blog post

the code for the CommonJS module system:

    (function (_, Kotlin, $module$jquery) {
        'use strict';
        function main$lambda(it) {
            $module$jquery('.toggle-panel').toggle(300);
        }
        function main(args) {
            $module$jquery('.toggle-button').click(main$lambda);
        }
        _.main_kand9s$ = main;
        main([]);
        return _;
    }(module.exports, require('kotlin'), require('jquery')));

and a plain module system (i.e. no module system at all):

    this['kotlin-1.1-demo'] = function (_, Kotlin) {
        'use strict';
        function main$lambda(it) {
            $('.toggle-panel').toggle(300);
        }
        function main(args) {
            $('.toggle-button').click(main$lambda);
        }
        _.main_kand9s$ = main;
        main([]);
        return _;
    }(typeof this['kotlin-1.1-demo'] === 'undefined' ? {} : this['kotlin-1.1-demo'], kotlin);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment