1.2.8 • Published 2 years ago

@gondel/plugin-resize v1.2.8

Weekly downloads
240
License
MIT
Repository
github
Last release
2 years ago

Resize Plugin

Installation

import { initResizePlugin } from '@gondel/plugin-resize';
initResizePlugin();

Event Listener

The resize event is fired if the element changed after a window.resize event. The event is throttled using requestAnimationFrame

import { Component, EventListener, GondelBaseComponent } from '@gondel/core';
import { WINDOW_RESIZED_EVENT } from '@gondel/plugin-resize';

@Component('WindowResize')
export class WindowResize extends GondelBaseComponent {
  @EventListener(WINDOW_RESIZED_EVENT)
  _handleWindowResizeEvent(event: UIEvent) {
    console.log(event);
  }
}

import { COMPONENT_RESIZED_EVENT, IComponentDimension } from '@gondel/plugin-resize';

@Component('ComponentResize')
export class ComponentResize extends GondelBaseComponent {
  @EventListener(COMPONENT_RESIZED_EVENT)
  _handleComponentResizeEvent(event: UIEvent, dimensions: IComponentDimension) {
    // event is only getting fired if the component dimensions did change
    console.log(event);
    console.log(dimensions);
  }
}

Known Issues

The initResizePlugin has to be called before any component is registered.

1.2.8

2 years ago

1.2.7

4 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

6 years ago

1.0.0-alpha.29

6 years ago

0.1.0

6 years ago