@gedit/resource
Advanced tools
Comparing version 0.1.46 to 0.1.48
@@ -29,2 +29,4 @@ import type { TextDocumentContentChangeEvent } from 'vscode-languageserver-protocol'; | ||
protected readonly toDisposeOnAutoSave: DisposableCollection; | ||
protected readonly onResourceChangedEmitter: Emitter<Resource>; | ||
readonly onResourceChanged: import("@gedit/utils").Event<Resource>; | ||
readonly onDirtyChanged: import("@gedit/utils").Event<void>; | ||
@@ -35,4 +37,9 @@ readonly onDidChangeContent: import("@gedit/utils").Event<ResourceChangeEvent<any>>; | ||
protected _valid: boolean; | ||
protected resource: Resource; | ||
resource: Resource; | ||
constructor(options: ResourceAutoSaveOptions); | ||
/** | ||
* 切换资源 | ||
* @param resource | ||
*/ | ||
changeResource(resource: Resource): void; | ||
dispose(): void; | ||
@@ -39,0 +46,0 @@ get dirty(): boolean; |
@@ -93,2 +93,4 @@ "use strict"; | ||
this.toDisposeOnAutoSave = new utils_1.DisposableCollection(); | ||
this.onResourceChangedEmitter = new utils_1.Emitter(); | ||
this.onResourceChanged = this.onResourceChangedEmitter.event; | ||
this.onDirtyChanged = this.onDirtyChangedEmitter.event; | ||
@@ -112,2 +114,13 @@ this.onDidChangeContent = this.onDidChangeContentEmitter.event; | ||
} | ||
/** | ||
* 切换资源 | ||
* @param resource | ||
*/ | ||
ResourceAutoSaveService.prototype.changeResource = function (resource) { | ||
this.resource.dispose(); // clear old resource | ||
this.toDispose.push(resource); | ||
this.resource = resource; | ||
this.options.resource = resource; | ||
this.onResourceChangedEmitter.fire(resource); | ||
}; | ||
ResourceAutoSaveService.prototype.dispose = function () { | ||
@@ -114,0 +127,0 @@ this.toDispose.dispose(); |
{ | ||
"name": "@gedit/resource", | ||
"version": "0.1.46", | ||
"version": "0.1.48", | ||
"license": "MIT", | ||
@@ -12,4 +12,4 @@ "main": "lib/common/index", | ||
"dependencies": { | ||
"@gedit/application-common": "^0.1.46", | ||
"@gedit/utils": "^0.1.46", | ||
"@gedit/application-common": "^0.1.48", | ||
"@gedit/utils": "^0.1.48", | ||
"vscode-languageserver-protocol": "^3.15.3" | ||
@@ -32,3 +32,3 @@ }, | ||
}, | ||
"gitHead": "e761d7ae6c701701ef4608fa67976dbd93cf9280" | ||
"gitHead": "6aabb78f19f490d6ee62b298db9aa4fbb6452658" | ||
} |
@@ -39,2 +39,4 @@ import { injectable, inject } from 'inversify'; | ||
protected readonly toDisposeOnAutoSave = new DisposableCollection(); | ||
protected readonly onResourceChangedEmitter = new Emitter<Resource>(); | ||
readonly onResourceChanged = this.onResourceChangedEmitter.event; | ||
readonly onDirtyChanged = this.onDirtyChangedEmitter.event; | ||
@@ -45,3 +47,3 @@ readonly onDidChangeContent = this.onDidChangeContentEmitter.event; | ||
protected _valid = false; | ||
protected resource: Resource; | ||
resource: Resource; | ||
@@ -61,2 +63,13 @@ constructor( | ||
} | ||
/** | ||
* 切换资源 | ||
* @param resource | ||
*/ | ||
changeResource(resource: Resource): void { | ||
this.resource.dispose(); // clear old resource | ||
this.toDispose.push(resource); | ||
this.resource = resource; | ||
this.options.resource = resource; | ||
this.onResourceChangedEmitter.fire(resource); | ||
} | ||
@@ -63,0 +76,0 @@ dispose(): void { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
99401
1650
Updated@gedit/utils@^0.1.48