Skip to content

Commit

Permalink
webflow: Added support for Webflow.require('tabs').redraw()
Browse files Browse the repository at this point in the history
  • Loading branch information
alexiglesias93 committed Dec 19, 2021
1 parent 0f5f6ee commit 46b502b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@finsweet/ts-utils",
"version": "0.27.5",
"version": "0.27.6",
"description": "Typescript utils for custom Webflow projects.",
"main": "index.ts",
"module": "index.ts",
Expand Down
6 changes: 5 additions & 1 deletion webflow/Webflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
type Callback = () => unknown;

export type WebflowModule = 'ix2' | 'commerce' | 'lottie' | 'lightbox' | 'slider';
export type WebflowModule = 'ix2' | 'commerce' | 'lottie' | 'lightbox' | 'slider' | 'tabs';

interface WebflowCommerce {
destroy: () => void;
Expand All @@ -24,6 +24,8 @@ interface WebflowSlider {
redraw: () => void;
}

type WebflowTabs = WebflowSlider;

interface WebflowIx2 {
destroy: () => void;
init: () => void;
Expand Down Expand Up @@ -75,6 +77,8 @@ export interface Webflow extends Pick<Callback[], 'push'> {
? WebflowLightbox
: Key extends 'slider'
? WebflowSlider
: Key extends 'tabs'
? WebflowTabs
: WebflowIx2)
| undefined;
}
Expand Down
3 changes: 3 additions & 0 deletions webflow/restartWebflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,8 @@ export const restartWebflow = async (modules?: WebflowModule[]): Promise<unknown
// Slider
if (modules?.includes('slider')) Webflow.require('slider')?.redraw();

// Tabs
if (modules?.includes('tabs')) Webflow.require('tabs')?.redraw();

return new Promise((resolve) => Webflow.push(() => resolve(undefined)));
};

0 comments on commit 46b502b

Please sign in to comment.