1.2.1 • Published 4 years ago
@riot-material/position-controller v1.2.1
position controller for riot-material
Installation
You can install it via nodejs
npm install @riot-material/position-controlleror download one of the bundled file
/**
* `dist/index.amd.js`
* `dist/index.umd.js`
*/
requirejs.config({
paths: {
"@riot-material/position-controller": "path/to/@riot-material/position-controller",
},
});
require(['@riot-material/position-controller'], function (positionController) {
// ...
});
/**
* `dist/index.js`
*/
import positionController from "@riot-material/position-controller";
// or
import { default as positionController } from "@riot-material/position-controller";otherwise you can include the script in your project html
<script src="@riot-material/position-controller/index.umd.js" />and access it via
window.riotMaterial.positionController;Methods
<default export>(element: HTMLElement):IPositionController
Interfaces
IPositionController
getPosition(): number
getSelectedIndex(): number
setSelectedIndex(index: number):IPositionController
getLength(): number
setLength(length: number):IPositionController
on(type, callback):IPositionController
- type:
"positionchanged" | "positionapplied" - callback:
(event:PositionChangedEvent|PositionAppliedEvent) => void
off(type, callback):IPositionController
- type:
"positionchanged" | "positionapplied" - callback:
(event:PositionChangedEvent|PositionAppliedEvent) => void
Types
PositionChangedEvent
detail: { position: number }
PositionAppliedEvent
detail: { previousIndex: number, currentIndex: number }