How to use the quasar.throttle function in quasar

To help you get started, we’ve selected a few quasar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yunity / karrot-frontend / src / group / api / groups.js View on Github external
function getOrCreateMarkUserActiveThrottleFn (groupId) {
  if (!markUserActiveThrottles[groupId]) {
    markUserActiveThrottles[groupId] = throttle(
      async () => markUserActive(groupId),
      1000 * 60 * 10, // 10 minutes
    )
  }
  return markUserActiveThrottles[groupId]
}
github yunity / karrot-frontend / src / services / detectMobileKeyboard.js View on Github external
ready(() => {
      window.addEventListener('resize', throttle(() => {
        // if the window is >150px smaller than original, we guess it's the keyboard...
        this.is.open = (size.original - getSize()) > 150
      }, 100))
    })
  },
github yunity / karrot-frontend / src / store / plugins / router.js View on Github external
export default store => {
  const isLoggedIn = () => store.getters['auth/isLoggedIn']
  const getUserGroupId = () => isLoggedIn() && store.getters['auth/user'].currentGroup
  const getGroup = (id) => store.getters['groups/get'](id)

  const throttledMarkUserActive = throttle(
    () => store.dispatch('currentGroup/markUserActive').catch(() => {}),
    1000 * 60 * 10, // 10 minutes
  )

  router.beforeEach(async (to, from, nextFn) => {
    store.dispatch('routeError/clear')
    let next

    // handle invite parameter
    const inviteToken = to.query.invite
    if (inviteToken) {
      if (isLoggedIn()) {
        store.dispatch('invitations/accept', inviteToken)
        next = { path: '/' }
      }
      else {
github yunity / karrot-frontend / src / authuser / datastore / auth.js View on Github external
import push from '@/subscriptions/datastore/auth/push'
import { throttle } from 'quasar'

function initialState () {
  return {
    user: null,
    redirectTo: null,
    joinGroupAfterLogin: null,
    acceptInviteAfterLogin: null,
    muteConversationAfterLogin: [],
    failedEmailDeliveries: [],
    maybeLoggedOut: false,
  }
}

const showLogoutToast = throttle((dispatch) => {
  dispatch('toasts/show', {
    message: 'USERDATA.LOGOUT_SUCCESS',
    config: {
      timeout: 5000,
    },
  }, { root: true })
}, 5000)

export default {
  namespaced: true,
  modules: { meta: createMetaModule(), push },
  state: initialState(),
  getters: {
    isLoggedIn: state => !!state.user,
    user: state => state.user,
    userId: state => state.user && state.user.id,
github yunity / karrot-frontend / src / maps / pages / Map.vue View on Github external
created () {
    this.mapMoveEnd = throttle(this.mapMoveEnd, 500)
  },
  methods: {
github yunity / karrot-frontend / src / base / api / axios.js View on Github external
const makeThrottledWarner = (message) =>
  throttle(() =>
    Notify.create({
      icon: 'priority_high',
      color: 'warning',
      position: 'bottom-left',
      timeout: 5000,
      message: i18n.t(message),
    }),
  5000)
github yunity / karrot-frontend / src / services / axios.js View on Github external
const makeThrottledWarner = (message) =>
  throttle(() =>
    Notify.create({
      type: 'warning',
      position: 'bottom-left',
      timeout: 5000,
      message: i18n.t(message),
    }),
  5000)