I’m working on a wallpaper engine application in angular and the documentation says to grab a property off the window object and set it to a function to get the current user properties. I’m trying to convert this logic into angular but haven’t been able to get it to work correctly.
Here’s what I’m trying to match:
window.wallpaperPropertyListener = {
applyUserProperties: function(properties) {
if (properties.yourproperty) { // Don't forget to check if the property is included in the event
// Checkbox / boolean example, change this as needed for your property type
if (properties.yourproperty.value == true) {
// Do something if your property is true
} else {
// Do something if your property is false
}
}
},
};
Here’s what I have:
app.module.ts
declare global {
interface Window {
wallpaperPropertyListener : any;
}
}
@NgModule({
declarations: [
AppComponent,
FuzzyTimeComponent
],
imports: [
BrowserModule,
NgbModule,
BrowserAnimationsModule
],
bootstrap: [AppComponent]
})
export class AppModule { }
app.component.ts
export class AppComponent implements AfterViewInit {
title = 'wordclock2';
constructor(private el: ElementRef, private renderer: Renderer2, private settingsService: SettingsService) {
window.wallpaperPropertyListener = {
applyUserProperties(properties) {
this.settingsService.setTimePeriodEnabled(false);
}
};
}
I’m not checking for any properties right now, since I just want to see if the function is ever called and it doesn’t seem like it is.
