This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Suspense, useRef, useMemo } from "react"; | |
| import { useEffect } from "react"; | |
| import { createPromise } from "./createPromise"; | |
| import { createIntersectionObserver } from "./createIntersectionObserver"; | |
| const isServer = typeof window === "undefined"; | |
| function SuspenseInner({ children, promise }) { | |
| if (!isServer && !promise.fulfilled) { | |
| // throw the promise to the suspense component |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const _ = require('lodash'); | |
| const getRandomNumber = (from, to) => Math.floor(Math.random() * to) + from; | |
| const getImageUrl = size => `http://www.placecage.com/${size}/${size}`; | |
| const getImages = numOfImages => _.range(numOfImages).map(i => getImageUrl(getRandomNumber(100, 800))); | |
| const controller = (context) => { | |
| const {setProps, wixCodeApi} = context; | |
| let currentSize = 5; | |
| return { |