path event fixes
This commit is contained in:
parent
8c1fb2d8cb
commit
8f7e816571
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/utils",
|
"name": "@ztimson/utils",
|
||||||
"version": "0.25.15",
|
"version": "0.25.16",
|
||||||
"description": "Utility library",
|
"description": "Utility library",
|
||||||
"author": "Zak Timson",
|
"author": "Zak Timson",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -99,7 +99,7 @@ export class PathEvent {
|
|||||||
method = '*';
|
method = '*';
|
||||||
}
|
}
|
||||||
let temp = p.split('/').filter(p => !!p);
|
let temp = p.split('/').filter(p => !!p);
|
||||||
this.module = temp.splice(0, 1)[0]?.toLowerCase() || '';
|
this.module = temp.splice(0, 1)[0] || '';
|
||||||
this.path = temp.join('/');
|
this.path = temp.join('/');
|
||||||
this.fullPath = `${this.module}${this.module && this.path ? '/' : ''}${this.path}`;
|
this.fullPath = `${this.module}${this.module && this.path ? '/' : ''}${this.path}`;
|
||||||
this.name = temp.pop() || '';
|
this.name = temp.pop() || '';
|
||||||
@ -265,7 +265,7 @@ export class PathEventEmitter implements IPathEventEmitter{
|
|||||||
|
|
||||||
on(event: Event | Event[], listener: PathListener): PathUnsubscribe {
|
on(event: Event | Event[], listener: PathListener): PathUnsubscribe {
|
||||||
makeArray(event).forEach(e => this.listeners.push([
|
makeArray(event).forEach(e => this.listeners.push([
|
||||||
new PathEvent(`${this.prefix}/${new PathEvent(e).toString()}`),
|
new PathEvent(`${this.prefix}/${e}`),
|
||||||
listener
|
listener
|
||||||
]));
|
]));
|
||||||
return () => this.off(listener);
|
return () => this.off(listener);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user