GithubHelp home page GithubHelp logo

idle-vue's Issues

Don't include idle-vue component in default build

For most people this is just bloat, most people will not use this component so you're just adding kB to their JS asset size. Just include it in the package as an example or to be extended or whatever. Anyone who wants to use this component can include it themselves.

For most people it will not work properly since it tried to request a PNG icon at a path that almost nobody will use.

Can the idleTime be set after initialisation?

It would be great to be able to change the ideTime option that you can set initially in the options. In my case, I have users that want to be able to configure the idle time-out of modals. For this, the timeout setting is stored in localStorage, and I've got it fetching from there to set on the idleTime option, but I can't see a way of setting it after the initial app load. Only solution I could think of so far is to force a refresh, but I'm reluctant to do that as I believe it's bad practice in SPAs. Appreciate the help!

Module not found: Error: Can't resolve './src/Idle'

I am getting this error while configuring it in main.js file. If I change the extension of the include in the index.js file from import IdleView from './src/Idle'; to import IdleView from './src/Idle.vue'; it works fine, but after changing this the build command fails. Any ideas as to why this is happening?

Vue 3 support

First of all.. Thank you for your nice work with handling of idle state.

We've encountered warnings using idle-vue with Vue 3 - regarding new naming conventions in Vue 3. Where the destroyed() functionality is now called unmounted.

Could this be changed in at new version bundle, to support Vue 3 ?

Error when importing idle-vue

I want to use idle-vue in an electron app using https://github.com/SimulatedGREG/electron-vue, but when I import idle-vue in my main.js file it throws an error:

Uncaught SyntaxError: Unexpected token import
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at eval (eval at <anonymous> (http://localhost:9080/renderer.js:1959:1), <anonymous>:1:18)

The main.js looks like this:

import 'basscss/css/basscss.min.css'
import 'flexboxgrid/css/flexboxgrid.min.css'

import 'gsap'

import Vue from 'vue'
import axios from 'axios'

import App from './App'
import router from './router'
import store from './vuex/store'
import i18n from './locales/index'
import IdleVue from 'idle-vue'

import './lib/qrcode'

if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
Vue.http = Vue.prototype.$http = axios
Vue.config.productionTip = false

Vue.use(IdleVue, { store })

/* eslint-disable no-new */
new Vue({
  components: { App },
  router,
  store,
  i18n,
  template: '<App/>'
}).$mount('#app')

It might happen because of a bad babel-loader configuration

Error: 'idleVue_onIdle' of undefined

I am using the latest version of the module.

This is how I am installing the module. I do not want to emit the event to all the component so I am omitting the eventHandler here.
Vue.use(IdleVue, { store, idleTime: 1*60*60*1000 });

I would expect that idleVue_onIdle event will not be called. But, in the console for each component, I am getting this error. Please see the screenshot here.
image

Just for the side note, I am able to watch the store property "isAppIdle" and it's working as expected. But, this console is making the things dirty.

Many thanks
Piyush

Multiple Idles

Is it possible to have multiple callbacks with different timings?

Idle-view component broken (PNG and clearRect errors)

Getting a 404 error touch.ba3be66.png cannot be found.
Also getting a ton of JS errors in build.js?16a9:880

Uncaught TypeError: this.ctx.clearRect is not a function
at VueComponent.spriteRender (build.js?16a9:880)
at VueComponent.boundFn [as spriteRender] (vue.esm.js?65d7:180)
at VueComponent.spriteLoop (build.js?16a9:888)
at boundFn (vue.esm.js?65d7:179)

Idle time option

I think idletime option does not work even If I put 500ms.
Any example of implementing this plugin as component and passing custom idle time to it?
I would be grateful
Thanks

what is the actual timer in this? I don't understand

I'm using this. It's working great. I have it working in a Quasar Framework app. I've been through all of the code here and in idle-js and I still don't see what is actually doing the countdown. What am I missing?

reference error: "window is not defined" when using in Nuxt.js

I'm trying to use this plugin in Nuxt.js.
So far I did (based on the example code):

  1. npm install --save idle-vue
  2. created /plugins/idle-vue.js with the following content:
import Vue from 'vue'
import IdleVue from 'idle-vue'

const eventsHub = new Vue()

Vue.use(IdleVue, {
  eventEmitter: eventsHub,
  idleTime: 10000
})
  1. imported the plugin in /nuxt.config.js:
plugins: [
    { src: '@/plugins/idle-vue.js'}
  ],
  1. added hooks to my Nuxt page Vue instance:
onIdle() {
  console.log('ZZZ');
},
onActive() {
  console.log('Hello');
},

This causes Nuxt to report reference error: "window is not defined"
Screenshot 2019-05-17 at 12 33 53

ERROR from UglifyJs Unexpected token: punc (()

Hello,

When building the project, Uglify throws this error.
ERROR in static/js/vendor.4955f0d5d2e9486bc600.js from UglifyJs Unexpected token: punc (()

As Evan explains in this discussion it's because idle-vue serves a non precompiled version of the file.

Could this be fixed? Thanks!

Error from uglifyJs

I added idle-vue with npm to my vue project and everything was working fine in run dev but when i tried to build my project I got the following error:

ERROR in static/js/vendor.87bf41a35bd9b3a1e693.js from UglifyJs Unexpected token: punc (() [./~/idle-vue/dist/build.js:678,0][static/js/vendor.87bf41a35bd9b3a1e693.js:12395,9]

Did anyone else experience this? I tried changing some settings in my .babelrc but I still get the error.

[suggestion] Moving the computed property to a getter

Hey,
Awesome job with idle-vue!

I don't understand why you are injecting a computed property to every Vue object.
Why don't you create a getter isAppIdle in the store and let us subscribe to that value? That would be way more flexible & practical ;)

Thanks a lot!

Event information

Gabriel,

Is it possible to get the event information directly through the evenEmitter (in isIdle() / isActive())? Currently, I am trying to switch to the active state on keyup (which works) however because IdleVue also listens for this event I get double events every time I keyup is emitted.

isIdle for All Tabs

i am facing a problem while implementing in my whole project.
isIdle works fine when my project is opened in single tab but when i open my project on second tab and no one is working on that tab isIdle value gets true whereas it should be false as user is working on the other tab of the project
How may i make it possible that if user is working on one tab of a site isIdle state must be false for all other tabs as well.
i am getting state by following
import store from './store'
Vue.use(IdleVue, { store})

const vm = new Vue({
store,
computed: {
messageStr() {
return this.isAppIdle ? 'ZZZ' : 'Hello'
}
}
})
putting condition on
$store.state.idleVue.isIdle

idle-vue seems to prevent reload nuxt app

I have an application with idle-vue implemented.
After some time running on localhost and meanwhile refreshing the application it appears the nuxt app suddenly keeps loading and waiting for a process in idle-vue, keeping the screen white. This is after a manual page refresh. When I pause the debugger in DevTools, the file that is processed is always build.js in idle-vue. I don't really know how to reproduce this as it happens after a unknown period of time.

I know the package is no longer maintained but it's worth a shot as it's messing with my workflow bigtime.
Any people have experienced this or any hints on how to debug this situation?

Stop idle tracking

Is there any way to stop idle tracking in a particular component and enable it after a certain interval?

Inquiry about tracking the idle users

I need to listen to a specific button, I've initialized the "events" as 'none'
and when I click on the button I'm changing the value of idleVue.isIdle in the store by committing a mutation:
this.$store.commit('idleVue/IDLE_CHANGED', false)
But the issue is, it's stopping to show me that notification after I clicked on that button (reset button).

How to make the package listen to a specific button?

Update the value of the isIdle in vuex by calling a mutation.

I'm trying to change the boolean value of the isIdle, bypassing a boolean param to the mutation idleVue/IDLE_CHANGED.
The code:
this.$store.commit('idleVue/IDLE_CHANGED', false)
And It does change the value of the isIdle in the store, but the timer after that doesn't work.

Do you have any idea about that?

nuxt with idle-view ?

I try add idle-vue to my Nuxt app. But when I use idle-view to view. it is show error
Property or method "isIdle" is not defined on the instance but referenced during render

This my config:
plugins/idle-vue.js:

import IdleVue from 'idle-vue'
import Vue from 'vue'
import Vuex from 'vuex'
import IdleVueComponent from 'idle-vue/src/components/Idle.vue'

const store = new Vuex.Store({})

const eventsHub = new Vue()
Vue.component('idle-view', IdleVueComponent)
Vue.use(IdleVue, {
  eventEmitter: eventsHub,
  store,
  idleTime: 10000
})

nuxt.config.js

plugins: [
    {
      src: '~/plugins/firebase.js',
      ssr: false
    },
...
  ],

pages/index.vue

.form-group
  idle-view

I use nuxt ^2.6.2. Please help me. Thank you

Typescript support

Hi Guys,

Do you have typescript support? When I try following the example it tells me that on onIdle() is not a function?

Difficulty dynamically setting idleTime

Hi!

I'm trying to set and get the idle time from a propety we've stored in our own vuex store and we've run in to a road block.

I want to try something like this, but whenever I try, the idleTime property is not available in vuex, where is this stored?

Is it possible to change the idleTime property during runtime or is it only during mounting the App component that it can be 'hot-reloaded'?

//IdleTime setup:
import Vue from 'vue';
import IdleVue from 'idle-vue';
import store from '@/store';

Vue.use(IdleVue, {
    // idleTime: 15000, // unable to change when un-commented
    store
});

//Store - different file
const state = {
    idleVue: {
        idleTime: 5000,
        isIdle: true
    }
};

export default {
    state
};```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.