@nephele/adapter-virtual
Version:
Virtual resource adapter for the Nephele WebDAV server.
28 lines • 815 B
JavaScript
export default class Lock {
constructor({ resource, username, }) {
this.token = '';
this.date = new Date();
this.timeout = 1000 * 60 * 60 * 24 * 2;
this.scope = 'exclusive';
this.depth = '0';
this.provisional = false;
this.owner = {};
this.resource = resource;
this.username = username;
}
async save() {
this.resource.file.locks[this.token] = {
username: this.username,
date: this.date.getTime(),
timeout: this.timeout,
scope: this.scope,
depth: this.depth,
provisional: this.provisional,
owner: this.owner,
};
}
async delete() {
delete this.resource.file.locks[this.token];
}
}
//# sourceMappingURL=Lock.js.map