-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmanage.js
More file actions
33 lines (29 loc) · 907 Bytes
/
Copy pathmanage.js
File metadata and controls
33 lines (29 loc) · 907 Bytes
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
// Gyazo
let ROOT_PROJECT_NAME = null;
const DAIIZ_GYAZO_TEXT_BUBBLE = "daiiz-gyazo-text-bubble";
exports.detectProject = function () {
return ROOT_PROJECT_NAME;
};
exports.install = () => {
return new Promise((resolve, reject) => {
const payload = {
command: "get-project-name",
func_names: ["daiiz-gyazo-text-bubble"],
};
window.app.runtime.sendMessage(payload, () => {});
window.app.runtime.onMessage.addListener(
(request, sender, sendResponse) => {
const { command, projectNames } = request;
if (command === "re:get-project-name") {
console.info("ScrapScripts:", projectNames);
if (projectNames[DAIIZ_GYAZO_TEXT_BUBBLE]) {
ROOT_PROJECT_NAME = projectNames[DAIIZ_GYAZO_TEXT_BUBBLE];
resolve(ROOT_PROJECT_NAME);
} else {
resolve("");
}
}
}
);
});
};