COMMUNITY

How to generte or improve code for js target?

I have a class like

class Main {

        static function main() {

            Cc.Class({

                'extends': Component,

                properties: {

                    myButton: {

                        'default': null,

                        type: Button,

                    },

                },

                onLoad: function() {},

                update: function(dt) {},

            });

        }

    }

and main.js we only want part of that . main function body .

  cc.Class({

    "extends": cc.Component, properties: { myButton: { "default": null, type: cc.Button } }, onLoad: function () {

    }, update: function (dt) {

    }

});

//maybe someone writes Marco function to do that?