Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getOrCreateMarkUserActiveThrottleFn (groupId) {
if (!markUserActiveThrottles[groupId]) {
markUserActiveThrottles[groupId] = throttle(
async () => markUserActive(groupId),
1000 * 60 * 10, // 10 minutes
)
}
return markUserActiveThrottles[groupId]
}
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))
})
},
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 {
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,
created () {
this.mapMoveEnd = throttle(this.mapMoveEnd, 500)
},
methods: {
const makeThrottledWarner = (message) =>
throttle(() =>
Notify.create({
icon: 'priority_high',
color: 'warning',
position: 'bottom-left',
timeout: 5000,
message: i18n.t(message),
}),
5000)
const makeThrottledWarner = (message) =>
throttle(() =>
Notify.create({
type: 'warning',
position: 'bottom-left',
timeout: 5000,
message: i18n.t(message),
}),
5000)