feeles-ide
Version:
The hackable and serializable IDE to make learning material
66 lines (55 loc) • 1.81 kB
JavaScript
import _defineProperty from 'babel-runtime/helpers/defineProperty';
import _slicedToArray from 'babel-runtime/helpers/slicedToArray';
import _regeneratorRuntime from 'babel-runtime/regenerator';
import _asyncToGenerator from 'babel-runtime/helpers/asyncToGenerator';
import _Promise from 'babel-runtime/core-js/promise';
var _this = this;
import * as ReactDOM from 'react-dom';
import init from './jsx/init';
import { default as Feeles } from './jsx/RootComponent';
var hasLoaded = new _Promise(function (resolve) {
if (document.readyState === 'complete') {
resolve();
} else {
window.addEventListener('load', function () {
return resolve();
});
}
});
var h4p = function () {
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(props) {
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return hasLoaded;
case 2:
init(props);
case 3:
case 'end':
return _context.stop();
}
}
}, _callee, _this);
}));
return function h4p(_x) {
return _ref.apply(this, arguments);
};
}();
h4p.init = init;
h4p.Feeles = Feeles;
h4p.unmount = function () {
return ReactDOM.unmountComponentAtNode.apply(ReactDOM, arguments);
};
// Auto launch from meta tags
var launch = document.querySelector('script[x-feeles-launch]');
if (launch) {
var _launch$getAttribute$ = launch.getAttribute('x-feeles-launch').split(','),
_launch$getAttribute$2 = _slicedToArray(_launch$getAttribute$, 2),
type = _launch$getAttribute$2[0],
arg = _launch$getAttribute$2[1];
h4p(_defineProperty({}, type, arg));
}
// export
export { h4p };