@@ -215,6 +215,10 @@ const defaultSteamId = {
215215let DOM_COMPONENT_ID = ''
216216//<-- DOM_COMPONENT_ID -->
217217
218+ let config = { }
219+ //<-- CONFIG -->
220+
221+
218222/**
219223 * @typedef {string | undefined } Tag
220224 */
@@ -223,6 +227,8 @@ let DOM_COMPONENT_ID = ''
223227export function getInstanceJs ( parentClass , addonTriggers , C3 ) {
224228 // @ts -ignore
225229 return class Pipelab extends parentClass {
230+ _additionalLoadPromises = [ ]
231+
226232 /** @type {SDK.IObjectInstance | undefined } */
227233 _inst ;
228234
@@ -349,6 +355,9 @@ export function getInstanceJs(parentClass, addonTriggers, C3) {
349355 * @param {any } _properties
350356 */
351357 constructor ( inst , _properties ) {
358+ console . info ( 'Pipelab v' + config . version )
359+ console . info ( 'SDK ' + sdk )
360+
352361 let dummyInst = undefined
353362 if ( sdk === 'v1' ) {
354363 dummyInst = inst
@@ -379,8 +388,38 @@ export function getInstanceJs(parentClass, addonTriggers, C3) {
379388 this . _trigger = this . Trigger ;
380389 }
381390
382- this . runtime . sdk . addLoadPromise (
383- this . _postToDOMAsync ( "get-fullscreen-state" )
391+ if ( sdk === "v1" ) {
392+ this . c3runtime = this . _runtime
393+ } else {
394+ this . c3runtime = this . runtime
395+ }
396+
397+ if ( sdk === "v1" ) {
398+ this . addLoadPromise = this . c3runtime . AddLoadPromise
399+ } else {
400+ this . addLoadPromise = this . c3runtime . sdk . addLoadPromise
401+ }
402+
403+ if ( sdk === "v1" ) {
404+ this . postToDOMAsync = this . PostToDOMAsync
405+ } else {
406+ this . postToDOMAsync = this . _postToDOMAsync
407+ }
408+
409+ if ( sdk === "v1" ) {
410+ this . postToDOM = this . PostToDOM
411+ } else {
412+ this . postToDOM = this . _postToDOM
413+ }
414+
415+ if ( sdk === "v1" ) {
416+ this . addDOMMessageHandler = this . AddDOMMessageHandler
417+ } else {
418+ this . addDOMMessageHandler = this . _addDOMMessageHandler
419+ }
420+
421+ this ?. addLoadPromise ?. (
422+ this . postToDOMAsync ( "get-fullscreen-state" )
384423 . then (
385424 /** @type {import("./sdk.js").PostFullscreenState } */
386425 data =>
@@ -389,7 +428,7 @@ export function getInstanceJs(parentClass, addonTriggers, C3) {
389428 } )
390429 ) ;
391430
392- this . _addDOMMessageHandler ( 'fullscreen-state-changed' , ( data ) => {
431+ this . addDOMMessageHandler ( 'fullscreen-state-changed' , ( data ) => {
393432 this . _fullscreenState = data . state
394433 } )
395434 }
@@ -427,6 +466,10 @@ export function getInstanceJs(parentClass, addonTriggers, C3) {
427466 wrap ( base , callback , fallback , force ) {
428467 // @ts -expect-error
429468 return ( /** @type {Parameters<T> } */ ...args ) => {
469+ if ( ! this . _isInitialized ) {
470+ console . warn ( "Plugin has no been initialized. Please use the according action at the start of layout" )
471+ }
472+
430473 // is initialized
431474 if ( this . _isInitialized ) {
432475 // and is connected to an engine
@@ -980,12 +1023,12 @@ export function getInstanceJs(parentClass, addonTriggers, C3) {
9801023 await this . ws ?. sendAndWaitForResponse ( order )
9811024 } , ( toggle ) => {
9821025 // Use DOM handler for fullscreen operations
983- if ( this . runtime . platformInfo . exportType === 'preview' ) {
1026+ if ( this . c3runtime . platformInfo . exportType === 'preview' ) {
9841027 /** @type {import('./sdk.js').PostFullscreenState } */
9851028 const state = {
9861029 state : toggle === 0 ? 0 : 1
9871030 }
988- this . _postToDOM ( 'set-fullscreen' , state )
1031+ this . postToDOM ( 'set-fullscreen' , state )
9891032 }
9901033 } )
9911034 _SetFullscreen = this . _SetFullscreenBase
0 commit comments