in legacy/src/Calendar/Views.tsx [498:548]
public initialize() {
const webContext: WebContext = VSS.getWebContext();
this._currentMember = {
displayName: webContext.user.name,
id: webContext.user.id,
imageUrl: "",
uniqueName: webContext.user.email,
url: "",
};
// Create calendar control
this._calendar = Controls.create(
Calendar.Calendar,
this._element,
$.extend(
{},
{
fullCalendarOptions: {
aspectRatio: this._getCalendarAspectRatio(),
handleWindowResize: false, // done by manually adjusting aspect ratio when the window is resized.
},
},
this._options,
),
);
EventSourceCollection.create(this._selectedTeam).then(eventSources => {
if (this._disposed) {
return;
}
eventSources.updateTeamContext(this._selectedTeam);
this._eventSources = eventSources;
this._calendar.addEvents(this._defaultEvents);
this._addDefaultEventSources();
this._calendar.addCallback(Calendar.FullCalendarCallbackType.viewDestroy, this._viewDestroy.bind(this));
this._calendar.addCallback(Calendar.FullCalendarCallbackType.eventAfterRender, this._eventAfterRender.bind(this));
this._calendar.addCallback(Calendar.FullCalendarCallbackType.eventClick, this._eventClick.bind(this));
this._calendar.addCallback(Calendar.FullCalendarCallbackType.eventDrop, this._eventMoved.bind(this));
this._calendar.addCallback(Calendar.FullCalendarCallbackType.eventResize, this._eventMoved.bind(this));
this._calendar.addCallback(Calendar.FullCalendarCallbackType.select, this._daysSelected.bind(this));
});
const setAspectRatio = Utils_Core.throttledDelegate(this, 300, () => {
this._calendar.setOption("aspectRatio", this._getCalendarAspectRatio());
});
window.addEventListener("resize", () => {
setAspectRatio();
});
}