-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b254f51
commit 83bb59e
Showing
25 changed files
with
403 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { MethodCallArgs } from '../WebDAVRequest'; | ||
import { XMLElement } from '../../helper/XML'; | ||
import { IResource } from '../../resource/IResource'; | ||
import { FSPath } from '../../manager/FSPath'; | ||
import { Lock } from '../../resource/lock/Lock'; | ||
export declare type EventsName = 'create' | 'delete' | 'copy' | 'move' | 'lock' | 'refreshLock' | 'unlock' | 'setProperty' | 'removeProperty' | 'write' | 'read' | 'addChild'; | ||
export declare type DetailsType = IResource | FSPath | Lock | XMLElement; | ||
export declare type Listener = (arg: MethodCallArgs, subjectResource: IResource, details?: DetailsType) => void; | ||
export declare function invoke(event: EventsName, arg: MethodCallArgs, subjectResource?: IResource, details?: DetailsType): void; | ||
export declare function register(event: EventsName, listener: Listener): void; | ||
export declare function registerWithName(event: EventsName, name: string, listener: Listener): void; | ||
export declare function clear(event: EventsName): void; | ||
export declare function clearAll(event: EventsName): void; | ||
export declare function remove(event: EventsName, listener: Listener): void; | ||
export declare function removeByName(event: EventsName, name: string): void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function getEventBag(_this, event) { | ||
if (!_this.__events) | ||
_this.__events = {}; | ||
if (event && !_this.__events[event]) { | ||
_this.__events[event] = { | ||
all: [], | ||
named: {} | ||
}; | ||
return _this.__events[event]; | ||
} | ||
return event ? _this.__events[event] : _this.__events; | ||
} | ||
function invoke(event, arg, subjectResource, details) { | ||
var events = getEventBag(this, event); | ||
events.all.forEach(function (e) { return process.nextTick(function () { return e(arg, subjectResource, details); }); }); | ||
} | ||
exports.invoke = invoke; | ||
function register(event, listener) { | ||
var events = getEventBag(this, event); | ||
events.all.push(listener); | ||
} | ||
exports.register = register; | ||
function registerWithName(event, name, listener) { | ||
var events = getEventBag(this, event); | ||
events.all.push(listener); | ||
events.named[name] = listener; | ||
} | ||
exports.registerWithName = registerWithName; | ||
function clear(event) { | ||
var events = getEventBag(this, event); | ||
events.all = []; | ||
events.named = {}; | ||
} | ||
exports.clear = clear; | ||
function clearAll(event) { | ||
this.__events = {}; | ||
} | ||
exports.clearAll = clearAll; | ||
function remove(event, listener) { | ||
var events = getEventBag(this, event); | ||
events.all.indexOf(listener); | ||
} | ||
exports.remove = remove; | ||
function removeByName(event, name) { | ||
var events = getEventBag(this, event); | ||
var listener = events.named[name]; | ||
if (listener) { | ||
delete events.named[name]; | ||
events.all.splice(events.all.indexOf(listener), 1); | ||
} | ||
} | ||
exports.removeByName = removeByName; |
Oops, something went wrong.