1.1.3 • Published 5 years ago

controller-controller v1.1.3

Weekly downloads
125
License
MIT
Repository
github
Last release
5 years ago

controller controller

Controller-controller is a package to manage different controllers based on viewport. With controller-controller you can use multiple controllers for different viewport sizes. This package will initialise and dispose controllers on viewport width change. This comes in handy when you have different functionality for e.g. Mobile- and Desktop-like viewport sizes.

How to use controller

Add controller-controller to your project with yarn or npm:

yarn add controller-controller

import controller-controller and create a new instance with a debounceDelay (ms) and an Array of objects with a minWidth and controller.

import ControllerController from 'controller-controller';
import MobileController from './MobileController';
import DesktopController from './DesktopController';

...

this.controllerManager = new ControllerController({
  debounceDelay: 250,
  controllers: [
    {
      minWidth: 0,
      controller: MobileController,
    },
    {
      minWidth: 1024,
      controller: DesktopController,
    },
  ]
})
1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago