wix-style-react
Version:
wix-style-react
60 lines (52 loc) • 2.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
var textDriverFactory = exports.textDriverFactory = function textDriverFactory(component) {
return {
/** returns the component element */
element: function element() {
return component;
},
/** returns the component text */
getText: function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", component.getText());
case 1:
case "end":
return _context.stop();
}
}
}, _callee, undefined);
}));
return function getText() {
return _ref.apply(this, arguments);
};
}(),
/** returns the component tag name */
getTagName: function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
return _context2.abrupt("return", component.getTagName());
case 1:
case "end":
return _context2.stop();
}
}
}, _callee2, undefined);
}));
return function getTagName() {
return _ref2.apply(this, arguments);
};
}()
};
};
exports.default = textDriverFactory;