@atlaskit/global-search
Version:
A cross-product search component (batteries included)
68 lines (54 loc) • 3.05 kB
JavaScript
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _get from "@babel/runtime/helpers/get";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
import PeopleSearchClientImpl from './PeopleSearchClient';
export var CachingPeopleSearchClient = /*#__PURE__*/function (_PeopleSearchClientIm) {
_inherits(CachingPeopleSearchClient, _PeopleSearchClientIm);
var _super = _createSuper(CachingPeopleSearchClient);
function CachingPeopleSearchClient(url, cloudId) {
_classCallCheck(this, CachingPeopleSearchClient);
return _super.call(this, url, cloudId);
}
_createClass(CachingPeopleSearchClient, [{
key: "getRecentPeople",
value: function () {
var _getRecentPeople = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
var prefetchedPeople;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!this.prefetchPeople) {
_context.next = 4;
break;
}
_context.next = 3;
return this.prefetchPeople;
case 3:
return _context.abrupt("return", _context.sent);
case 4:
prefetchedPeople = _get(_getPrototypeOf(CachingPeopleSearchClient.prototype), "getRecentPeople", this).call(this);
this.prefetchPeople = prefetchedPeople;
return _context.abrupt("return", prefetchedPeople);
case 7:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function getRecentPeople() {
return _getRecentPeople.apply(this, arguments);
}
return getRecentPeople;
}()
}]);
return CachingPeopleSearchClient;
}(PeopleSearchClientImpl);