wix-style-react
Version:
59 lines (51 loc) • 1.73 kB
JavaScript
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
import _regeneratorRuntime from "@babel/runtime/regenerator";
export var textDriverFactory = function textDriverFactory(component) {
return {
/** returns the component element */
element: function element() {
return component;
},
/** returns the component text */
getText: function () {
var _getText = _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);
}));
function getText() {
return _getText.apply(this, arguments);
}
return getText;
}(),
/** returns the component tag name */
getTagName: function () {
var _getTagName = _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);
}));
function getTagName() {
return _getTagName.apply(this, arguments);
}
return getTagName;
}()
};
};
export default textDriverFactory;