import * as vscode from "vscode" ; export class NotificationBar implements vscode . Disposable { private statusBar : vscode . StatusBarItem ; private lastUpdateTime : number ; constructor ( id , name ) { this . statusBar = vscode . window . createStatusBarItem ( id , vscode . StatusBarAlignment . Left , 1 ) ; this . statusBar . name = name ; } public show ( text , duration ? ) { this . statusBar . text = text ; this . statusBar . show ( ) ; const updateTime = Date . now ( ) ; this . lastUpdateTime = updateTime ; if ( duration ) { setTimeout ( ( ) => { if ( this . lastUpdateTime === updateTime ) { this . statusBar . text = "" ; this . statusBar . hide ( ) ; } } , duration ) ; } } public clear ( ) { this . statusBar . text = "" ; this . statusBar . hide ( ) ; } public dispose ( ) { this . statusBar . dispose ( ) ; } }