refactor: only keep one User instance
This commit is contained in:
@@ -11,10 +11,10 @@ export default class DSHome {
|
|||||||
private devstarHomePageUrl: string;
|
private devstarHomePageUrl: string;
|
||||||
private devstarDomain: string | undefined
|
private devstarDomain: string | undefined
|
||||||
|
|
||||||
constructor(context: vscode.ExtensionContext) {
|
constructor(context: vscode.ExtensionContext, user: User) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.user = new User(context);
|
this.user = user;
|
||||||
this.remoteContainer = new RemoteContainer(this.user);
|
this.remoteContainer = new RemoteContainer(user);
|
||||||
|
|
||||||
this.devstarDomain = utils.getDevstarDomain()
|
this.devstarDomain = utils.getDevstarDomain()
|
||||||
if (undefined == this.devstarDomain || "" == this.devstarDomain) {
|
if (undefined == this.devstarDomain || "" == this.devstarDomain) {
|
||||||
|
@@ -12,8 +12,9 @@ export class DevStarExtension {
|
|||||||
|
|
||||||
constructor(private context: vscode.ExtensionContext) {
|
constructor(private context: vscode.ExtensionContext) {
|
||||||
this.user = new User(context);
|
this.user = new User(context);
|
||||||
|
// 只保持一个User实例
|
||||||
this.remoteContainer = new RemoteContainer(this.user);
|
this.remoteContainer = new RemoteContainer(this.user);
|
||||||
this.dsHome = new DSHome(context);
|
this.dsHome = new DSHome(context, this.user);
|
||||||
|
|
||||||
const handler = vscode.window.registerUriHandler({
|
const handler = vscode.window.registerUriHandler({
|
||||||
handleUri: async (uri: vscode.Uri) => {
|
handleUri: async (uri: vscode.Uri) => {
|
||||||
|
Reference in New Issue
Block a user