How to attach an Resize Event Listener to Storybook Angular

88 views Asked by At

I have written some function that calculates the screen size and returns the number of tabs that can be displayed on the screen so while I resize the screen size I can again call the same function and get a number of tabs to be displayed.

Here, I wanted to call a function that updates the number of tabs to be visible on the resize of the browser.

So, I want to call a function on Resize of the browser or from the Viewport in Storybook Angular.

The solution mentioned solution works with normal Angular projects but does not work in the scenario of Storybook.

I have tried using the

onResize(event){ // my function };

Also tried added

@HostListener('window:resize', ['$event']) onResize(event) { event.this.updateVisibleTabs(); // function call. }

0

There are 0 answers