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 #17 from AtomLinter/arcanemagus/improve-activation
Browse files Browse the repository at this point in the history
Defer package dependency checks
  • Loading branch information
Arcanemagus authored Jul 13, 2017
2 parents 5e75060 + 15f0db4 commit 33e898b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 12 additions & 1 deletion lib/minimap-linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,22 @@ const bindings = new Map();
export default {
// Atom package lifecycle events start
activate() {
require('atom-package-deps').install('minimap-linter');
this.idleCallbacks = new Set();
let depsCallbackID;
const installMinimapLinterDeps = () => {
this.idleCallbacks.delete(depsCallbackID);
if (!atom.inSpecMode()) {
require('atom-package-deps').install('minimap-linter');
}
};
depsCallbackID = window.requestIdleCallback(installMinimapLinterDeps);
this.idleCallbacks.add(depsCallbackID);
this.subscriptions = new CompositeDisposable();
},

deactivate() {
this.idleCallbacks.forEach(callbackID => window.cancelIdleCallback(callbackID));
this.idleCallbacks.clear();
if (!this.minimapProvider) {
return;
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
"atom": true
},
"env": {
"node": true
"node": true,
"browser": true
}
}
}

0 comments on commit 33e898b

Please sign in to comment.