Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #413 from AtomLinter/arcanemagus/improve-startup
Browse files Browse the repository at this point in the history
Defer package dependency check
  • Loading branch information
Arcanemagus authored Apr 25, 2017
2 parents 4b160ba + 26003c5 commit d2fa35a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
24 changes: 19 additions & 5 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,24 @@ const generateInvalidPointTrace = async (execPath, match, filePath, textEditor,

export default {
activate() {
require('atom-package-deps').install('linter-flake8');
this.idleCallbacks = new Set();

// FIXME: Remove after a few versions
if (typeof atom.config.get('linter-flake8.disableTimeout') !== 'undefined') {
atom.config.unset('linter-flake8.disableTimeout');
}
let packageDepsID;
const linterFlake8Deps = () => {
this.idleCallbacks.delete(packageDepsID);

// Request checking / installation of package dependencies
if (!atom.inSpecMode()) {
require('atom-package-deps').install('linter-flake8');
}

// FIXME: Remove after a few versions
if (typeof atom.config.get('linter-flake8.disableTimeout') !== 'undefined') {
atom.config.unset('linter-flake8.disableTimeout');
}
};
packageDepsID = window.requestIdleCallback(linterFlake8Deps);
this.idleCallbacks.add(packageDepsID);

this.subscriptions = new CompositeDisposable();
this.subscriptions.add(
Expand Down Expand Up @@ -118,6 +130,8 @@ export default {
},

deactivate() {
this.idleCallbacks.forEach(callbackID => window.cancelIdleCallback(callbackID));
this.idleCallbacks.clear();
this.subscriptions.dispose();
},

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@
"atom": true
},
"env": {
"node": true
"node": true,
"browser": true
}
},
"providedServices": {
Expand Down

0 comments on commit d2fa35a

Please sign in to comment.