Nautical Poseidon Mythology

    @okiba/sizes-cache

    1.0.12 • Public • Published

    Okiba / SizesCache

    A class to compute and cache element sizes.

    import { qs } from '@okiba/dom'
    import SizesCache from '@okiba/size-cache'
    
    const sizes = SizesCache.get(qs('#app'))
    console.log(sizes)

    Installation

    npm i --save @okiba/sizes-cache

    Or import it directly in the browser

    <script type="module" src="https://unpkg.com/@okiba/sizes-cache/index.js"></script>

    Usage

    import SizesCache from '@okiba/sizes-cache'

    Untranspiled code 🛑

    Okiba UI packages are not transpiled, so don't forget to transpile them with your favourite bundler. For example, using Babel with Webpack, you should prevent imports from okiba to be excluded from transpilation, like follows:

    {
      test: /\.js$/,
      exclude: /node_modules\/(?!(@okiba)\/).*/,
      use: {
        loader: 'babel-loader',
        options: {
          presets: ['@babel/preset-env']
        }
      }
    }

    get(el)

    Element's sizes getter

    Arguments

    + el: Element

    compute(el)

    Computes element's sizes

    Arguments

    + el: Element

    onResize()

    Updates elements' sizes on resize

    listen()

    Adds resize event listener to EventManager

    unlisten()

    Removes resize event listener from EventManager

    reset()

    Resets component's data

    Keywords

    none

    Install

    npm i @okiba/sizes-cache

    DownloadsWeekly Downloads

    2

    Version

    1.0.12

    License

    MIT

    Unpacked Size

    240 kB

    Total Files

    6

    Last publish

    Collaborators

    • fiad
    • ghzmdr
    • lavolpecheprogramma