Open pabrams opened 5 years ago
I also want to raise this question. What versions of TFS are supported by this SDK?
interface ThemeDetail {
id: string;
name: string;
extends: string;
data: IDictionaryStringTo<string>;
}
interface DarkThemeDetail extends ThemeDetail {
isDark: boolean;
}
//register
XDM.globalObjectRegistry.register("DevOps.SdkClient", function () {
return {
dispatchEvent: function (eventName: string, data: { detail: ThemeDetail }) {
window.dispatchEvent(new CustomEvent<ThemeDetail>(eventName, data));
}
};
});
//use
public static bindThemeChangedEventListener(themeChanged?: (themeDetail: DarkThemeDetail) => void): void {
window.addEventListener("themeChanged", (event: Event) => {
const themeEventObject: CustomEvent<DarkThemeDetail> = <CustomEvent<DarkThemeDetail>>event;
const newTheme = themeEventObject.detail;
const isDark: boolean = (newTheme && newTheme.isDark) || false;
newTheme.isDark = isDark;
if (themeChanged) {
themeChanged(newTheme);
}
VSS.applyTheme(newTheme.data);
});
}
It successfully listens for subject change events on the host.
You can register the event in a monaco-editor
, for example, and respond to it, otherwise your monaco-editor
theme will not change.
I don't see any docs on this yet...
We are on TFS 2017 Update 3.
When I rebuild and try the samples, after I change the category in the manifest to something recognized (TFS complains about the Pipelines category when I try to upload the .vsix to my on-prem), and add missing .html content types, I get the following:
It's trying to invokeRemoteMethod with a parameter of
"Devops.HostControl"
, which i guess is something that's supposed to be on the server already? So this means my TFS is not supported?parentChannel.invokeRemoteMethod<IExtensionHandshakeResult>("initialHandshake", hostControlId, [initOptions]).then((handshakeData) => {