Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support change idle time #43

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": ["es2015"]
"presets": ["@babel/preset-env"]
}
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ module.exports = {
sourceType: 'module'
},
// https://github.com/feross/standard/blob/master/RULES.md
extends: 'standard',
extends: [
'plugin:vue/essential',
'standard'
],
// required to lint *.vue files
plugins: [
'vue',
'html',
'promise'
],
Expand Down
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ sudo: false
language: node_js

node_js:
- "6"
- "7"
- "8"
- "stable"

Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,41 @@ const vm = new Vue({
</div>
```


#### Example - init with setting value

``` javascript

import Vue from 'vue'
import IdleVue from 'idle-vue'

const eventsHub = new Vue()

export default async ( { Vue, store } ) => {

let idleTime = store.state.settings.idleTime
if (idleTime === 0) {
// No Lock, Set one year
idleTime = 365 * 24 * 60 * 60 * 1000
}
Vue.use(IdleVue, { eventEmitter: eventsHub, idleTime })
}

```

#### Example - Change idle value

``` javascript

let idleTime = this.settings.idleTime
if (idleTime === 0) {
// No Lock, Set one year
idleTime = 365 * 24 * 60 * 60 * 1000
}
this.changeIdleTime( idleTime)

```

### Options

`idle-vue` accepts the following options when loaded; all of them are facultative, except `store` or `eventEmitter`; they cannot be both omitted:
Expand Down
3 changes: 3 additions & 0 deletions build/webpack.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ function resolve (dir) {
return path.join(__dirname, '..', dir)
}

const nodeEnv = process.env.NODE_ENV
const isProduction = nodeEnv !== 'development'
module.exports = {
mode: isProduction ? 'production' : 'development',
entry: {
app: './src/main.js'
},
Expand Down
21 changes: 13 additions & 8 deletions build/webpack.prod.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var webpack = require('webpack')
var config = require('../config')
var merge = require('webpack-merge')
var baseWebpackConfig = require('./webpack.base.conf')
var UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
var env = process.env.NODE_ENV === 'testing'
? require('../config/test.env')
: config.build.env
Expand All @@ -30,14 +30,19 @@ var webpackConfig = merge(baseWebpackConfig, {
// http://vuejs.github.io/vue-loader/en/workflow/production.html
new webpack.DefinePlugin({
'process.env': env
}),
new UglifyJSPlugin({
compress: {
warnings: false
},
sourceMap: true
})
]
],
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
extractComments: 'all',
terserOptions: {
compress: {
drop_console: true
}
}
})]
}
})

module.exports = webpackConfig
3 changes: 2 additions & 1 deletion dist/build.js

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions dist/build.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/* 0 */

/* 1 */

/* harmony default export */

/* harmony import */

/*#__PURE__*/

/************************************************************************/

/******/

/***/

// Check if module is in cache

// Create a new module (and put it into the cache)

// Execute the module function

// Flag the module as loaded

// Load entry module and return exports

// Object.prototype.hasOwnProperty.call

// Return the exports of the module

// The module cache

// The require function

// __webpack_public_path__

// create a fake namespace object

// define __esModule on exports

// define getter function for harmony exports

// expose the module cache

// expose the modules object (__webpack_modules__)

// getDefaultExport function for compatibility with non-harmony modules

// mode & 1: value is a module id, require it

// mode & 2: merge all properties of value into the ns

// mode & 4: return value when already ns object

// mode & 8|1: behave like require

// ms

// webpackBootstrap

//# sourceMappingURL=Idle.js.map
2 changes: 1 addition & 1 deletion dist/build.js.map

Large diffs are not rendered by default.

Loading