Skip to content

Commit

Permalink
add loadWait to NftFrameConfig for configurable loading time input
Browse files Browse the repository at this point in the history
  • Loading branch information
electrovir committed Oct 21, 2023
1 parent 7d40188 commit 12f145d
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 15 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@toniq-labs/toniq-nft-frame-mono-repo-root",
"version": "1.0.10",
"version": "1.1.0",
"private": true,
"license": "MIT",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion packages/demo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@toniq-labs/toniq-nft-frame-demo",
"version": "1.0.10",
"version": "1.1.0",
"private": true,
"license": "MIT",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@toniq-labs/toniq-nft-frame-scripts",
"version": "1.0.10",
"version": "1.1.0",
"private": true,
"scripts": {
"compile": "virmator compile && npm run execute",
Expand Down
2 changes: 1 addition & 1 deletion packages/tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@toniq-labs/toniq-nft-frame-tests",
"version": "1.0.10",
"version": "1.1.0",
"private": true,
"license": "MIT",
"author": {
Expand Down
2 changes: 0 additions & 2 deletions packages/tests/src/test-cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,11 @@ export const testCases: ReadonlyArray<TestCase> = rawTestCases
.map((rawTestCase) => {
return [
{
...rawTestCase,
...mediumSize,
nftUrl: joinUrlParts(nftURlBase || testIframeUrl, rawTestCase.nftId),
childFrameUrl: testIframeUrl,
},
{
...rawTestCase,
...largeSize,
nftUrl: joinUrlParts(nftURlBase || testIframeUrl, rawTestCase.nftId),
childFrameUrl: testIframeUrl,
Expand Down
2 changes: 1 addition & 1 deletion packages/toniq-nft-frame/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@toniq-labs/toniq-nft-frame",
"version": "1.0.10",
"version": "1.1.0",
"homepage": "https://github.com/Toniq-Labs/nft-frame",
"bugs": {
"url": "https://github.com/Toniq-Labs/nft-frame/issues"
Expand Down
3 changes: 1 addition & 2 deletions packages/toniq-nft-frame/src/iframe/iframe-html.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {waitForAnimationFrame} from '@augment-vir/browser';
import {awaitedForEach, isTruthy, wait} from '@augment-vir/common';
import {convertTemplateToString, html} from 'element-vir';
import {NftConfigForChildIframe} from '../nft-frame-config';
Expand Down Expand Up @@ -216,7 +215,7 @@ export async function setTemplateHtml(
}
}

await waitForAnimationFrame(10);
await wait(nftConfig.loadWait?.milliseconds ?? 500);

return htmlElement;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/toniq-nft-frame/src/nft-frame-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const nftConfigConst = {
max: undefined as Dimensions | undefined,
/** The min NFT size constraints which the NFT will be resized to fit within. */
min: undefined as Dimensions | undefined,
/** How long to wait for the nft to load before calculating size. Defaults to 500 milliseconds. */
loadWait: undefined as {milliseconds: number} | undefined,
/** For hard-coding the final NFT size. Setting this can cause distortions. */
forcedFinalNftSize: undefined as Dimensions | undefined,
/**
Expand Down

0 comments on commit 12f145d

Please sign in to comment.