1. vue-throttle-event
throttle events based on requestAnimationFrame
vue-throttle-event
Package: vue-throttle-event
Created by: scaccogatto
Last modified: Tue, 28 Jun 2022 20:32:51 GMT
Version: 1.4.0
License: MIT
Downloads: 27
Repository: https://github.com/scaccogatto/vue-throttle-event

Install

npm install vue-throttle-event
yarn add vue-throttle-event

vue-throttle-event

throttle events based on requestAnimationFrame

Status

Build Status

Features

Installation

npm

$ npm install vue-throttle-event --save-dev

Vue's main.js

 import VueThrottleEvent from 'vue-throttle-event'

Vue.use(VueThrottleEvent)

Usage

Example

 methods: {
  customEventHandler (e) {
    // e.detail.origin is the original event object
    // logic here..
  }
}
created () {
  this.$throttle('mousemove', 'mouse-moved-throttled')
  this.$on('mouse-moved-throttled', this.customEventHandler)
}

Arguments

  • type (String): the event type
  • customEventName (String): the custom event name that will be fired on next requestAnimationFrame
  • targetObject (Object) [optional]: the physical EventTarget where the CustomEvent will be fired, defaults on vm.$el

Returns

  • function representing the real function added to the targetObject, so you can unbind it when you want

Testing

This software uses mocha as testing framework

  • Clone this repository
  • cd vue-throttle-event
  • npm install
  • npm test

Feel free to contribute and ask questions

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code