MCPcopy Index your code
hub / github.com/simstudioai/sim / constructor

Method constructor

apps/sim/lib/pptx-renderer/core/viewer.ts:88–130  ·  view source on GitHub ↗
(container: HTMLElement, options?: ViewerOptions)

Source from the content-addressed store, hash-verified

86 }
87
88 constructor(container: HTMLElement, options?: ViewerOptions) {
89 super()
90 this.container = container
91 this.viewerOptions = options ?? {}
92 const zoomPercent = this.normalizeZoomPercent(options?.zoomPercent ?? 100)
93 this._fitMode = options?.fitMode ?? 'contain'
94 this.zoomFactor = zoomPercent / 100
95
96 // Register shorthand callbacks as event listeners
97 if (options?.onSlideChange) {
98 const cb = options.onSlideChange
99 this.addEventListener('slidechange', ((e: CustomEvent) =>
100 cb(e.detail.index)) as EventListener)
101 }
102 if (options?.onSlideRendered) {
103 const cb = options.onSlideRendered
104 this.addEventListener('sliderendered', ((e: CustomEvent) =>
105 cb(e.detail.index, e.detail.element)) as EventListener)
106 }
107 if (options?.onSlideError) {
108 const cb = options.onSlideError
109 this.addEventListener('slideerror', ((e: CustomEvent) =>
110 cb(e.detail.index, e.detail.error)) as EventListener)
111 }
112 if (options?.onSlideUnmounted) {
113 const cb = options.onSlideUnmounted
114 this.addEventListener('slideunmounted', ((e: CustomEvent) =>
115 cb(e.detail.index)) as EventListener)
116 }
117 if (options?.onNodeError) {
118 const cb = options.onNodeError
119 this.addEventListener('nodeerror', ((e: CustomEvent) =>
120 cb(e.detail.nodeId, e.detail.error)) as EventListener)
121 }
122 if (options?.onRenderStart) {
123 const cb = options.onRenderStart
124 this.addEventListener('renderstart', () => cb())
125 }
126 if (options?.onRenderComplete) {
127 const cb = options.onRenderComplete
128 this.addEventListener('rendercomplete', () => cb())
129 }
130 }
131
132 // -----------------------------------------------------------------------
133 // Event dispatch helpers

Callers

nothing calls this directly

Calls 1

normalizeZoomPercentMethod · 0.95

Tested by

no test coverage detected