Giter Club home page Giter Club logo

from-resize's Introduction

semantic-release

All Contributors

From Resize

We all love using CSS Flex and Grids. However, in certain cases, a change in Dom container dimension may require its content to be redrawn. To address such uses cases, Resize Observer Specification was published. Resize Observer is now widely supported in modern browsers.

However, In the age of RxJs Observables, I find the API for Resize Observer a bit cumbersome to use. So I thought, it would be nice to build an RxJs wrapper around this API.

Advantages

  • Returns an Observable that emits on every container dimension change
  • You can set the watch direction to be Horizontal, Vertical or Both.
  • Set an initial debounceTime to control the emit frequency
  • React on first load using emitOnStart
  • Harness the power of RxJs Operators to do wonders!

Installation

Checkout github packages for instructions.

Download @twig-it artifacts from Github Packages

  • Create an .npmrc file in your repo
  • Add @twig-it:registry=https://npm.pkg.github.com
  • Create a PAT that has read access to Github Packages. Let's call this token GPRead
  • Set this token in npm for your CI runs. Example below:
     - name: Npm Install
         run: npm config set '//npm.pkg.github.com/:_authToken' "${GPRREAD}" && npm ci
         env:
           GPRREAD: ${{ secrets.GPREAD }}
    
    

Example:

An Example usage where from-resize will be useful.

  • An SVG/Canvas chart inside an HTML container
  • After initial render, the dimension of this HTML container changes without a window resize event.
  • This requires us to redraw the chart. To do this, we need to watch the container for dimension changes and then redraw.

Demo

Checkout Demo page!

Api Docs

Checkout Api docs!

Blogs

Build With

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Anand Tiwary

๐Ÿค” ๐Ÿ’ป ๐Ÿ”ง

This project follows the all-contributors specification. Contributions of any kind welcome!

from-resize's People

Contributors

allcontributors[bot] avatar anandtiwary avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

from-resize's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.