@shopify/react-async
Advanced tools
Comparing version 1.2.2 to 1.2.4
import * as React from 'react'; | ||
import { LoadProps } from '@shopify/async'; | ||
import { LoadProps, DeferTiming } from '@shopify/async'; | ||
import { Omit } from '@shopify/useful-types'; | ||
import { DeferTiming } from './shared'; | ||
import { AsyncAssetManager } from './context/assets'; | ||
@@ -6,0 +5,0 @@ export interface AsyncPropsRuntime { |
@@ -5,5 +5,6 @@ "use strict"; | ||
var React = tslib_1.__importStar(require("react")); | ||
var async_1 = require("@shopify/async"); | ||
var react_effect_1 = require("@shopify/react-effect"); | ||
var shared_1 = require("./shared"); | ||
var assets_1 = require("./context/assets"); | ||
/* eslint-enable camelcase */ | ||
var ConnectedAsync = /** @class */ (function (_super) { | ||
@@ -48,3 +49,3 @@ tslib_1.__extends(ConnectedAsync, _super); | ||
}); }; | ||
if (this.props.defer === shared_1.DeferTiming.Idle && | ||
if (this.props.defer === async_1.DeferTiming.Idle && | ||
'requestIdleCallback' in window) { | ||
@@ -51,0 +52,0 @@ this.idleCallbackHandle = window.requestIdleCallback(load); |
import * as React from 'react'; | ||
import { LoadProps } from '@shopify/async'; | ||
import { LoadProps, DeferTiming } from '@shopify/async'; | ||
import { Props as ComponentProps } from '@shopify/useful-types'; | ||
import { Async, AsyncPropsRuntime } from './Async'; | ||
import { DeferTiming } from './shared'; | ||
interface ConstantProps { | ||
@@ -7,0 +6,0 @@ async?: AsyncPropsRuntime; |
@@ -5,4 +5,4 @@ "use strict"; | ||
var React = tslib_1.__importStar(require("react")); | ||
var async_1 = require("@shopify/async"); | ||
var Async_1 = require("./Async"); | ||
var shared_1 = require("./shared"); | ||
function createAsyncComponent(_a) { | ||
@@ -22,3 +22,3 @@ var id = _a.id, load = _a.load, defer = _a.defer, renderLoading = _a.renderLoading, _b = _a.renderPreload, renderPreload = _b === void 0 ? noopRender : _b, _c = _a.renderPrefetch, renderPrefetch = _c === void 0 ? noopRender : _c, _d = _a.renderKeepFresh, renderKeepFresh = _d === void 0 ? noopRender : _d; | ||
renderPreload(componentProps), | ||
React.createElement(Async_1.Async, tslib_1.__assign({ defer: shared_1.DeferTiming.Idle, load: load }, asyncProps)))); | ||
React.createElement(Async_1.Async, tslib_1.__assign({ defer: async_1.DeferTiming.Idle, load: load }, asyncProps)))); | ||
} | ||
@@ -29,3 +29,3 @@ function Prefetch(props) { | ||
renderPrefetch(componentProps), | ||
React.createElement(Async_1.Async, tslib_1.__assign({ defer: shared_1.DeferTiming.Mount, load: load }, asyncProps)))); | ||
React.createElement(Async_1.Async, tslib_1.__assign({ defer: async_1.DeferTiming.Mount, load: load }, asyncProps)))); | ||
} | ||
@@ -36,3 +36,3 @@ function KeepFresh(props) { | ||
renderKeepFresh(componentProps), | ||
React.createElement(Async_1.Async, tslib_1.__assign({ defer: shared_1.DeferTiming.Idle, load: load }, asyncProps)))); | ||
React.createElement(Async_1.Async, tslib_1.__assign({ defer: async_1.DeferTiming.Idle, load: load }, asyncProps)))); | ||
} | ||
@@ -39,0 +39,0 @@ // Once we upgrade past TS 3.1, this will no longer be necessary, |
@@ -6,4 +6,4 @@ export { Async, AsyncPropsRuntime } from './Async'; | ||
export { createAsyncContext, AsyncContextType } from './provider'; | ||
export { DeferTiming } from './shared'; | ||
export { DeferTiming } from '@shopify/async'; | ||
export { AsyncAssetContext, AsyncAssetManager } from './context/assets'; | ||
export { PrefetchContext, PrefetchManager } from './context/prefetch'; |
@@ -13,4 +13,4 @@ "use strict"; | ||
exports.createAsyncContext = provider_1.createAsyncContext; | ||
var shared_1 = require("./shared"); | ||
exports.DeferTiming = shared_1.DeferTiming; | ||
var async_1 = require("@shopify/async"); | ||
exports.DeferTiming = async_1.DeferTiming; | ||
var assets_1 = require("./context/assets"); | ||
@@ -17,0 +17,0 @@ exports.AsyncAssetContext = assets_1.AsyncAssetContext; |
@@ -5,4 +5,4 @@ "use strict"; | ||
var React = tslib_1.__importStar(require("react")); | ||
var async_1 = require("@shopify/async"); | ||
var Async_1 = require("./Async"); | ||
var shared_1 = require("./shared"); | ||
function createAsyncContext(_a) { | ||
@@ -18,3 +18,3 @@ var id = _a.id, load = _a.load; | ||
function Preload() { | ||
return React.createElement(Async_1.Async, { defer: shared_1.DeferTiming.Idle, load: load }); | ||
return React.createElement(Async_1.Async, { defer: async_1.DeferTiming.Idle, load: load }); | ||
} | ||
@@ -21,0 +21,0 @@ return { Context: Context, Provider: Provider, Consumer: Consumer, Preload: Preload }; |
@@ -5,5 +5,1 @@ /// <reference types="react" /> | ||
} | React.ComponentType<Props>; | ||
export declare enum DeferTiming { | ||
Mount = 0, | ||
Idle = 1 | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var DeferTiming; | ||
(function (DeferTiming) { | ||
DeferTiming[DeferTiming["Mount"] = 0] = "Mount"; | ||
DeferTiming[DeferTiming["Idle"] = 1] = "Idle"; | ||
})(DeferTiming = exports.DeferTiming || (exports.DeferTiming = {})); |
{ | ||
"name": "@shopify/react-async", | ||
"version": "1.2.2", | ||
"version": "1.2.4", | ||
"license": "MIT", | ||
@@ -27,3 +27,3 @@ "description": "Tools for creating powerful, asynchronously-loaded React components.", | ||
"dependencies": { | ||
"@shopify/async": "^1.1.0", | ||
"@shopify/async": "^1.2.1", | ||
"@shopify/javascript-utilities": "^2.4.0", | ||
@@ -30,0 +30,0 @@ "@shopify/react-effect": "^2.0.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40661
618
Updated@shopify/async@^1.2.1