-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.js
36 lines (32 loc) · 823 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"use strict";
let disposables = null;
module.exports = {
activate(){
const {CompositeDisposable} = require("atom");
disposables = new CompositeDisposable();
const packageFiles = [
"./lib/conversion.js",
"./lib/editing.js",
"./lib/hyperlinks.js",
"./lib/previewing.js",
];
// Don't block main thread while activating.
return Promise.resolve().then(() => {
for(const file of packageFiles)
disposables.add(...require(file)());
});
},
deactivate(){
if(null !== disposables){
disposables.dispose();
disposables = null;
}
},
createTroffView(state){
const fs = require("fs");
if(state.editorId || fs.existsSync(state.filePath) && fs.lstatSync(state.filePath).isFile()){
const TroffView = require("./lib/views/troff-view.js");
return new TroffView(state);
}
},
};