svelte-watch-resize
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.3 • Public • Published

    svelte-watch-resize (npm, demo)

    Watch element resize in Svelte

    Installation

    npm i -S svelte-watch-resize

    Usage

    <script>
        import { watchResize } from "svelte-watch-resize";
     
        let leftWidth;
        let mainWidth;
     
        function handleLeftResize(node) {
            leftWidth = node.clientWidth;
        }
     
        function handleMainResize(node) {
            mainWidth = node.clientWidth;
        }
    </script> 
     
    <div class="root">
        <div class="content leftContent" use:watchResize={handleLeftResize}>
            {leftWidth}
        </div>
        <div class="content mainContent" use:watchResize={handleMainResize}>
            {mainWidth}
        </div>
    </div>

    Install

    npm i svelte-watch-resize

    DownloadsWeekly Downloads

    472

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    4.28 kB

    Total Files

    6

    Last publish

    Collaborators

    • xelaok