harunurhan / idlejs Goto Github PK
View Code? Open in Web Editor NEWExecute stuff when user is idle or interactive
License: MIT License
Execute stuff when user is idle or interactive
License: MIT License
Our Angular application uses Jest for unit testing, and we found out that idlejs library does not work with Jest. See errors below:
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html
Details:
C:\dev\src\trunk\my-apps\node_modules\idlejs\dist\index.js:1
export { Idle } from './idle';
^^^^^^
SyntaxError: Unexpected token 'export'
> 8 | import {Idle, NotIdle} from 'idlejs/dist';
| ^
9 |
10 | @Injectable({
11 | providedIn: 'root'
at Runtime._execModule (../../node_modules/jest-runtime/build/index.js:1179:56)
i tried to check the idle timer in my webapp , it is working in Desktop but when i try to access the same in the mobile devices , the idle timer is not working .
Steps:
Log in to my web App in my mobile (Chrome Browser)
Push it to Background app
Lock my mobile device
Come back after 15 mins to check , if i see a modal about User Inactive.
Result: I could not see any dialog box. Is the timer is working ?.. Can u please help me
Here is my Code To check the Idle Timer :
const TouchDeviceIdle = new Idle()
.whenNot([
{
events: ['touchcancel','touchmove','touchstart','focus','focusin'],
target: document,
},
])
.whenNotInteractive()
.within(15)
.do(() => {
if(this.sessionModalShow){
TouchDeviceIdle.stop();
}else{
this.userInactive(TouchDeviceIdle);
}
})
.start(); */
I need to call like below
const idle = new Idle()
.whenNotInteractive()
.within(5,1000)
//.do(() => console.log('IDLE'))
.do(() => LoginPage) //Need to call LoginPage
.start();
Is it possible to achieve my requirement using this plugin..?
https://jasmine.github.io/api/2.7/Clock.html could be used.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.