Code Monkey home page Code Monkey logo

Comments (6)

nightire avatar nightire commented on August 16, 2024

Why not involve with ES6 (ES2015 now), native support for class syntax

from cocoabean.

victorteokw avatar victorteokw commented on August 16, 2024

@nightire I remember there is a tool to compile ES6 into ES5. What's the name and is it easy to setup?

from cocoabean.

nightire avatar nightire commented on August 16, 2024

@cheunghy There're bunch of project can make it happen, my personal recommendation is Babel, very easy to setup and use, just a pure node module, you can use it as a command or in node script.

from cocoabean.

victorteokw avatar victorteokw commented on August 16, 2024

I found this: https://github.com/babel/ruby-babel-transpiler
Officially supported by babel.

Indeed, ES6 syntax will be support by CocoaBean.

How about user just wants to write ES5?

from cocoabean.

nightire avatar nightire commented on August 16, 2024

ES6 is superset of ES5, it doesn't prevent user write valid ES5 codes, except lacks of some new features that ONLY provided ES6. For example, the Class syntax is just a sugar layer implements the prototype based OO system, users can still write equivalent ES5 codes to archive these.

BTW, by using Babel, you can easily translate ES6 to ES5, so basically it still runs with ES5 codes for now.

from cocoabean.

victorteokw avatar victorteokw commented on August 16, 2024

@nightire Thanks.

So the answer comes out:
User declare a javaScript class in ES6.
And CocoaBean will convert when generating target application js file.

from cocoabean.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.