Skip to content

Commit 2a86608

Browse files
author
loris
committed
added babel build to es5
1 parent e2e0153 commit 2a86608

File tree

5 files changed

+3913
-4
lines changed

5 files changed

+3913
-4
lines changed

.babelrc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"presets": [
3+
"env"
4+
],
5+
"env": {
6+
"dist": {
7+
"ignore": [
8+
"**/*.test.js"
9+
]
10+
}
11+
}
12+
}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

index.es5.js

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
"use strict";
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
7+
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; }; }();
8+
9+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10+
11+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
12+
13+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
14+
15+
// TODO: compute a unique hash for multiple reactified components
16+
var getId = function getId(component) {
17+
return "vue-component-id";
18+
};
19+
20+
exports.default = function (buildVueInstance) {
21+
return function (_reactInstance) {
22+
var id = getId();
23+
24+
return function (_reactInstance$Compon) {
25+
_inherits(Wrapper, _reactInstance$Compon);
26+
27+
function Wrapper(props) {
28+
_classCallCheck(this, Wrapper);
29+
30+
var _this = _possibleConstructorReturn(this, (Wrapper.__proto__ || Object.getPrototypeOf(Wrapper)).call(this, props));
31+
32+
_this.myself = _reactInstance.createRef();
33+
return _this;
34+
}
35+
36+
_createClass(Wrapper, [{
37+
key: "render",
38+
value: function render() {
39+
return _reactInstance.createElement("div", { ref: this.myself });
40+
}
41+
}, {
42+
key: "componentDidMount",
43+
value: function componentDidMount() {
44+
this.container = document.createElement("div");
45+
this.myself.current.appendChild(this.container);
46+
this.vueApp = buildVueInstance(this.props);
47+
this.vueApp.$mount(this.container);
48+
}
49+
}, {
50+
key: "componentWillUnmount",
51+
value: function componentWillUnmount() {
52+
this.vueApp.$destroy();
53+
delete this.container;
54+
delete this.myself;
55+
delete this.vueApp;
56+
}
57+
}]);
58+
59+
return Wrapper;
60+
}(_reactInstance.Component);
61+
};
62+
};

0 commit comments

Comments
 (0)