mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-04-27 05:51:23 +02:00
Merge the globals of multiple plugins of the same name.
This commit is contained in:
@@ -182,20 +182,24 @@ var Contexts = Module("contexts", {
|
|||||||
function (dir) dir.contains(file, true),
|
function (dir) dir.contains(file, true),
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
let name = isPlugin ? file.getRelativeDescriptor(isPlugin).replace(File.PATH_SEP, "-")
|
||||||
|
: file.leafName;
|
||||||
|
let id = name.replace(/\.[^.]*$/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase());
|
||||||
|
|
||||||
let contextPath = file.path;
|
let contextPath = file.path;
|
||||||
let self = Set.has(plugins, contextPath) && plugins.contexts[contextPath];
|
let self = Set.has(plugins, contextPath) && plugins.contexts[contextPath];
|
||||||
|
|
||||||
|
if (!self && isPlugin)
|
||||||
|
self = Set.has(plugins, id) && plugins[id];
|
||||||
|
|
||||||
if (self) {
|
if (self) {
|
||||||
if (Set.has(self, "onUnload"))
|
if (Set.has(self, "onUnload"))
|
||||||
self.onUnload();
|
self.onUnload();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let name = isPlugin ? file.getRelativeDescriptor(isPlugin).replace(File.PATH_SEP, "-")
|
|
||||||
: file.leafName;
|
|
||||||
|
|
||||||
self = args && !isArray(args) ? args : newContext.apply(null, args || [userContext]);
|
self = args && !isArray(args) ? args : newContext.apply(null, args || [userContext]);
|
||||||
update(self, {
|
update(self, {
|
||||||
NAME: Const(name.replace(/\.[^.]*$/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase())),
|
NAME: Const(id),
|
||||||
|
|
||||||
PATH: Const(file.path),
|
PATH: Const(file.path),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user