Skip to content

Instantly share code, notes, and snippets.

@Ahrengot
Last active March 20, 2017 11:40
Show Gist options
  • Save Ahrengot/20821e496901891181191a4a6fcd8792 to your computer and use it in GitHub Desktop.
Save Ahrengot/20821e496901891181191a4a6fcd8792 to your computer and use it in GitHub Desktop.
/**
* Babel.js
* Source:
class Component {
constructor(msg = "hi") {
this.msg = msg;
}
render() {
const div = document.createElement("div");
div.innerHtml = this.msg;
}
}
*/
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Component = function () {
function Component() {
var msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "hi";
_classCallCheck(this, Component);
this.msg = msg;
}
_createClass(Component, [{
key: "render",
value: function render() {
var div = document.createElement("div");
div.innerHtml = this.msg;
}
}]);
return Component;
}();
/**
* CoffeeScript
* Source:
class Component
constructor: (msg = "hi") ->
@msg = msg;
render: ->
div = document.createElement "div";
div.innerHtml = @msg;
*/
var Component;
Component = (function() {
function Component(msg) {
if (msg == null) {
msg = "hi";
}
this.msg = msg;
}
Component.prototype.render = function() {
var div;
div = document.createElement("div");
return div.innerHtml = this.msg;
};
return Component;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment