# How to generte or improve code for js target?

**URL:** https://community.haxe.org/t/how-to-generte-or-improve-code-for-js-target/2464
**Category:** Haxe
**Created:** [May 22, 2020, 2:21pm UTC](https://community.haxe.org/t/how-to-generte-or-improve-code-for-js-target/2464 "2020-05-22T14:21:29Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![Zhan](https://community.haxe.org/user_avatar/community.haxe.org/zhan/32/468_2.png) [@Zhan](https://community.haxe.org/u/Zhan)
#### Post date: [May 22, 2020, 2:21pm UTC](https://community.haxe.org/t/how-to-generte-or-improve-code-for-js-target/2464/1 "2020-05-22T14:21:29Z")

</div>

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?

---

_[View the full topic](https://community.haxe.org/t/how-to-generte-or-improve-code-for-js-target/2464)._
