Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

Commit 3f57bed

Browse files
committed
Make startup much much faster
1 parent 1ae2a03 commit 3f57bed

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

index.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
'use babel';
22

3-
import path from 'path';
4-
import { CompositeDisposable } from 'atom';
5-
import opn from 'opn';
6-
import Canduit from 'canduit';
7-
83
const CONFIG_DEFAULT_HOST = 'https://phabricator.example.com/api/';
94
const CONFIG_DEFAULT_TOKEN = 'api-XYZ';
105

@@ -41,7 +36,7 @@ export default {
4136
},
4237

4338
activate(state) {
44-
this.subscriptions = new CompositeDisposable();
39+
this.subscriptions = new (require('atom').CompositeDisposable)();
4540

4641
this.subscriptions.add(
4742
atom.config.onDidChange('open-in-diffusion.conduit-host', () => {
@@ -95,6 +90,7 @@ export default {
9590

9691
conduitFactory() {
9792
return new Promise((resolve, reject) => {
93+
const Canduit = require('canduit');
9894
new Canduit(this.conduitConfig(), (err, canduit) => {
9995
if (err) {
10096
reject(err);
@@ -138,7 +134,7 @@ export default {
138134
},
139135

140136
genFindPhabProject(projectPath) {
141-
const searchTerm = path.basename(projectPath);
137+
const searchTerm = require('path').basename(projectPath);
142138

143139
if (this.foundProjects[projectPath]) {
144140
return Promise.resolve(this.foundProjects[projectPath]);
@@ -202,7 +198,7 @@ export default {
202198
? project.fields.callsign
203199
: project.id;
204200

205-
opn(`https://phabricator.pinadmin.com/diffusion/${id}/browse/master${relativeFilePath}${range}`);
201+
require('opn')(`https://phabricator.pinadmin.com/diffusion/${id}/browse/master${relativeFilePath}${range}`);
206202
})
207203
.catch((message) => {
208204
console.warn(`Unable to open ${nuclideFilePath}. ${message}`);

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,10 @@
1212
"dependencies": {
1313
"canduit": "^1.3.1",
1414
"opn": "^5.1.0"
15-
}
15+
},
16+
"activationEvents": [
17+
"application:new-file",
18+
"application:new-window",
19+
"application:open-file"
20+
]
1621
}

0 commit comments

Comments
 (0)