@khanacademy/wonder-blocks-timing
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -32,3 +32,3 @@ // @flow | ||
render() { | ||
render(): React.Node { | ||
const {children} = this.props; | ||
@@ -35,0 +35,0 @@ return children(this._actionScheduler); |
@@ -89,2 +89,15 @@ import { Component, forwardRef, createElement } from 'react'; | ||
function _isNativeReflectConstruct() { | ||
if (typeof Reflect === "undefined" || !Reflect.construct) return false; | ||
if (Reflect.construct.sham) return false; | ||
if (typeof Proxy === "function") return true; | ||
try { | ||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
function _assertThisInitialized(self) { | ||
@@ -106,20 +119,52 @@ if (self === void 0) { | ||
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 _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _iterableToArray(iter) { | ||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); | ||
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
@@ -136,5 +181,3 @@ | ||
*/ | ||
var Timeout = | ||
/*#__PURE__*/ | ||
function () { | ||
var Timeout = /*#__PURE__*/function () { | ||
/** | ||
@@ -257,5 +300,3 @@ * Creates a timeout that will invoke the given action after | ||
*/ | ||
var Interval = | ||
/*#__PURE__*/ | ||
function () { | ||
var Interval = /*#__PURE__*/function () { | ||
/** | ||
@@ -377,5 +418,3 @@ * Creates an interval that will invoke the given action after | ||
*/ | ||
var AnimationFrame = | ||
/*#__PURE__*/ | ||
function () { | ||
var AnimationFrame = /*#__PURE__*/function () { | ||
/** | ||
@@ -486,5 +525,3 @@ * Creates an animation frame request that will invoke the given action. | ||
*/ | ||
var ActionScheduler = | ||
/*#__PURE__*/ | ||
function () { | ||
var ActionScheduler = /*#__PURE__*/function () { | ||
function ActionScheduler() { | ||
@@ -554,10 +591,8 @@ _classCallCheck(this, ActionScheduler); | ||
*/ | ||
var ActionSchedulerProvider = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
var ActionSchedulerProvider = /*#__PURE__*/function (_React$Component) { | ||
_inherits(ActionSchedulerProvider, _React$Component); | ||
var _super = _createSuper(ActionSchedulerProvider); | ||
function ActionSchedulerProvider() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -571,3 +606,3 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(ActionSchedulerProvider)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
@@ -606,4 +641,4 @@ _defineProperty(_assertThisInitialized(_this), "_actionScheduler", new ActionScheduler()); | ||
return forwardRef(function (props, ref) { | ||
return createElement(ActionSchedulerProvider, null, function (schedule) { | ||
return createElement(WrappedComponent, _extends({}, props, { | ||
return /*#__PURE__*/createElement(ActionSchedulerProvider, null, function (schedule) { | ||
return /*#__PURE__*/createElement(WrappedComponent, _extends({}, props, { | ||
ref: ref, | ||
@@ -610,0 +645,0 @@ schedule: schedule |
@@ -99,4 +99,8 @@ module.exports = | ||
"use strict"; | ||
// ESM COMPAT FLAG | ||
__webpack_require__.r(__webpack_exports__); | ||
// EXPORTS | ||
__webpack_require__.d(__webpack_exports__, "withActionScheduler", function() { return /* reexport */ withActionScheduler; }); | ||
// EXTERNAL MODULE: external "react" | ||
@@ -123,5 +127,3 @@ var external_react_ = __webpack_require__(0); | ||
*/ | ||
var Timeout = | ||
/*#__PURE__*/ | ||
function () { | ||
var Timeout = /*#__PURE__*/function () { | ||
/** | ||
@@ -254,5 +256,3 @@ * Creates a timeout that will invoke the given action after | ||
*/ | ||
var Interval = | ||
/*#__PURE__*/ | ||
function () { | ||
var Interval = /*#__PURE__*/function () { | ||
/** | ||
@@ -384,5 +384,3 @@ * Creates an interval that will invoke the given action after | ||
*/ | ||
var AnimationFrame = | ||
/*#__PURE__*/ | ||
function () { | ||
var AnimationFrame = /*#__PURE__*/function () { | ||
/** | ||
@@ -489,10 +487,14 @@ * Creates an animation frame request that will invoke the given action. | ||
// CONCATENATED MODULE: ./packages/wonder-blocks-timing/util/action-scheduler.js | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function action_scheduler_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -516,5 +518,3 @@ | ||
*/ | ||
var action_scheduler_ActionScheduler = | ||
/*#__PURE__*/ | ||
function () { | ||
var action_scheduler_ActionScheduler = /*#__PURE__*/function () { | ||
function ActionScheduler() { | ||
@@ -576,3 +576,3 @@ action_scheduler_classCallCheck(this, ActionScheduler); | ||
// CONCATENATED MODULE: ./packages/wonder-blocks-timing/components/action-scheduler-provider.js | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -585,11 +585,15 @@ function action_scheduler_provider_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
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 _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -611,10 +615,8 @@ function action_scheduler_provider_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
*/ | ||
var action_scheduler_provider_ActionSchedulerProvider = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
var action_scheduler_provider_ActionSchedulerProvider = /*#__PURE__*/function (_React$Component) { | ||
_inherits(ActionSchedulerProvider, _React$Component); | ||
var _super = _createSuper(ActionSchedulerProvider); | ||
function ActionSchedulerProvider() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -628,3 +630,3 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(ActionSchedulerProvider)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
@@ -670,4 +672,4 @@ action_scheduler_provider_defineProperty(_assertThisInitialized(_this), "_actionScheduler", new action_scheduler_ActionScheduler()); | ||
return external_react_["forwardRef"](function (props, ref) { | ||
return external_react_["createElement"](action_scheduler_provider_ActionSchedulerProvider, null, function (schedule) { | ||
return external_react_["createElement"](WrappedComponent, _extends({}, props, { | ||
return /*#__PURE__*/external_react_["createElement"](action_scheduler_provider_ActionSchedulerProvider, null, function (schedule) { | ||
return /*#__PURE__*/external_react_["createElement"](WrappedComponent, _extends({}, props, { | ||
ref: ref, | ||
@@ -680,3 +682,2 @@ schedule: schedule | ||
// CONCATENATED MODULE: ./packages/wonder-blocks-timing/index.js | ||
/* concated harmony reexport withActionScheduler */__webpack_require__.d(__webpack_exports__, "withActionScheduler", function() { return withActionScheduler; }); | ||
@@ -683,0 +684,0 @@ |
@@ -320,3 +320,3 @@ Abstractions for common timing APIs like `setTimeout`, `setInterval` and | ||
state = { | ||
state: State = { | ||
timerFired: false; | ||
@@ -370,3 +370,3 @@ }; | ||
class MyWonderBlocksComponentImpl extends React.Component<Props, State> { | ||
state = { | ||
state: State = { | ||
timerFired: false; | ||
@@ -373,0 +373,0 @@ }; |
@@ -9,2 +9,3 @@ // @flow | ||
WithActionSchedulerProps, | ||
WithoutActionScheduler, | ||
} from "./util/types.js"; | ||
@@ -19,4 +20,5 @@ | ||
WithActionSchedulerProps, | ||
WithoutActionScheduler, | ||
}; | ||
export {default as withActionScheduler} from "./components/with-action-scheduler.js"; |
{ | ||
"name": "@khanacademy/wonder-blocks-timing", | ||
"private": false, | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"design": "v1", | ||
@@ -24,3 +24,3 @@ "publishConfig": { | ||
"license": "MIT", | ||
"gitHead": "9ce272758e112a23de91af6f8e70f61843ea5b5b" | ||
"gitHead": "644907d5558f4ab46a8ecb3c7e22be8bd3a9920e" | ||
} |
@@ -244,2 +244,6 @@ // @flow | ||
export type WithoutActionScheduler<TProps: {...}> = $Exact< | ||
$Rest<TProps, WithActionSchedulerProps>, | ||
>; | ||
/** | ||
@@ -246,0 +250,0 @@ * Extends the given props with props that the `withActionScheduler` higher |
124283
2709