AI-generated Key Takeaways
- 
          
AdsLoader enables requesting ads from ad servers by registering for the AdsManagerLoadedEvent and then requesting ads.
 - 
          
The constructor creates an AdsLoader instance with a specified AdDisplayContainer.
 - 
          
Methods include adding/removing event listeners for ads manager loaded events, ad events, and ad error events.
 - 
          
You can signal content completion for post-roll ads and clean up internal state with provided methods.
 - 
          
The class provides methods to retrieve the IMA SDK settings instance and the version of the current SDK.
 
| Constructors | |
|---|---|
              constructor
             | 
            Constructor.  | 
          
| Methods | |
|---|---|
              add
             | 
            Adds a listener for ads manager loaded events.  | 
          
              content
             | 
            Signals to the SDK that the content is finished.  | 
          
              destroy
             | 
            Cleans up the internal state.  | 
          
              get
             | 
            Returns the IMA SDK settings instance.  | 
          
              get
             | 
            Returns the version of the current SDK.  | 
          
              remove
             | 
            Removes a listener for ads manager loaded events.  | 
          
              request
             | 
            Request ads from a server.  | 
          
Constructors
constructor
new AdsLoader(container: AdDisplayContainer): AdsLoader
            | Parameters | |
|---|---|
                    container:
                      AdDisplayContainer
                   | 
                  The display container for ads. | 
| Returns | |
|---|---|
                    AdsLoader
                   | 
                  |
Methods
addEventListener
addEventListener(type: ADS_MANAGER_LOADED, listener: ((event: AdsManagerLoadedEvent) => void),
              optCapture?: boolean,
              optHandlerScope?: object): void
            | Parameters | |
|---|---|
                    type:
                      ADS_MANAGER_LOADED
                   | 
                  The type of event to listen for. | 
                    listener: ((event: AdsManagerLoadedEvent) => void)
                   | 
                  A function called each time an event of this type occurs. | 
                    
                   | 
                  Deprecated and a no-op; retained for backward compatibility. | 
                    
                   | 
                  Deprecated: Listener scope object. Use arrow functions or bind listener instead. | 
addEventListener(type: google.ima.AdEvent.Type, listener: ((event: AdEvent) => void),
              optCapture?: boolean,
              optHandlerScope?: object): void
            | Parameters | |
|---|---|
                    type:
                      google.ima.AdEvent.Type
                   | 
                  The type of event to listen for. | 
                    listener: ((event: AdEvent) => void)
                   | 
                  A function called each time an event of this type occurs. | 
                    
                   | 
                  Deprecated and a no-op; retained for backward compatibility. | 
                    
                   | 
                  Deprecated: Listener scope object. Use arrow functions or bind listener instead. | 
addEventListener(type: AD_ERROR, listener: ((event: AdErrorEvent) => void),
              optCapture?: boolean,
              optHandlerScope?: object): void
            | Parameters | |
|---|---|
                    type:
                      AD_ERROR
                   | 
                  The type of event to listen for. | 
                    listener: ((event: AdErrorEvent) => void)
                   | 
                  A function called each time an event of this type occurs. | 
                    
                   | 
                  Deprecated and a no-op; retained for backward compatibility. | 
                    
                   | 
                  Deprecated: Listener scope object. Use arrow functions or bind listener instead. | 
contentComplete
contentComplete(): void
            destroy
destroy(): void
            getSettings
getSettings(): ImaSdkSettings
            | Returns | |
|---|---|
                    ImaSdkSettings
                   | 
                  The settings instance. | 
getVersion
getVersion(): string
            | Returns | |
|---|---|
                    string
                   | 
                  |
removeEventListener
removeEventListener(type: ADS_MANAGER_LOADED, listener: ((event: AdsManagerLoadedEvent) => void),
              optCapture?: boolean,
              optHandlerScope?: object): void
            addEventListener.
              | Parameters | |
|---|---|
                    type:
                      ADS_MANAGER_LOADED
                   | 
                  The type of event for which to remove the listener. | 
                    listener: ((event: AdsManagerLoadedEvent) => void)
                   | 
                  The function to remove as a listener. | 
                    
                   | 
                  Deprecated and a no-op; retained for backward compatibility. | 
                    
                   | 
                  Deprecated: Listener scope object. Use arrow functions or bind listener instead. | 
removeEventListener(type: google.ima.AdEvent.Type, listener: ((event: AdEvent) => void),
              optCapture?: boolean,
              optHandlerScope?: object): void
            addEventListener.
              | Parameters | |
|---|---|
                    type:
                      google.ima.AdEvent.Type
                   | 
                  The type of event for which to remove the listener. | 
                    listener: ((event: AdEvent) => void)
                   | 
                  The function to remove as a listener. | 
                    
                   | 
                  Deprecated and a no-op; retained for backward compatibility. | 
                    
                   | 
                  Deprecated: Listener scope object. Use arrow functions or bind listener instead. | 
removeEventListener(type: AD_ERROR, listener: ((event: AdErrorEvent) => void),
              optCapture?: boolean,
              optHandlerScope?: object): void
            addEventListener.
              | Parameters | |
|---|---|
                    type:
                      AD_ERROR
                   | 
                  The type of event for which to remove the listener. | 
                    listener: ((event: AdErrorEvent) => void)
                   | 
                  The function to remove as a listener. | 
                    
                   | 
                  Deprecated and a no-op; retained for backward compatibility. | 
                    
                   | 
                  Deprecated: Listener scope object. Use arrow functions or bind listener instead. | 
requestAds
requestAds(adsRequest: AdsRequest, userRequestContext?: object): void
            | Parameters | |
|---|---|
                    adsRequest:
                      AdsRequest
                   | 
                  AdsRequest instance containing data for the ads request. | 
                    
                   | 
                  User-provided object that is associated with the ads request. It can be retrieved when the ads are loaded. |