-
Notifications
You must be signed in to change notification settings - Fork 33
/
main.js
44 lines (38 loc) · 1.04 KB
/
main.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
37
38
39
40
41
42
43
44
'use strict';
const Package = require('./utils/package');
const Fs = require('fire-fs');
const Path = require('path');
module.exports = {
load () {
Package.mount();
},
unload () {
Package.unmount();
},
// register your ipc messages here
messages: {
'open' () {
// open entry panel registered in package.json
Editor.Panel.open('i18n');
Package.metrics();
},
'import-asset' (event, path) {
Editor.assetdb.refresh(path, (err, results) => {
if (err) {
Editor.assetdb.error('Failed to reimport asset %s, %s', path, err.stack);
return;
}
Editor.assetdb._handleRefreshResults(results);
let metaPath = path + '.meta';
if (Fs.existsSync(Editor.url(metaPath))) {
let meta = Fs.readJsonSync(Editor.url(metaPath));
meta.isPlugin = true;
Fs.outputJsonSync(Editor.url(metaPath), meta);
} else {
Editor.log('Failed to set language data file to plugin script');
return;
}
});
}
},
};