Skip to content

Commit

Permalink
feat(Ads): Remove circular dependency (#6868)
Browse files Browse the repository at this point in the history
To eliminate `* @Suppress {missingRequire}` it was necessary to create a
new class with the constants and deprecate the old ones. That's why this
change is feat.
  • Loading branch information
avelad authored Jun 20, 2024
1 parent 69fe20f commit e39defb
Show file tree
Hide file tree
Showing 25 changed files with 616 additions and 202 deletions.
1 change: 1 addition & 0 deletions build/types/ads
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Ad Insertion Functionality

+../../lib/ads/ad_manager.js
+../../lib/ads/ad_utils.js
+../../lib/ads/ads_stats.js
+../../lib/ads/client_side_ad.js
+../../lib/ads/client_side_ad_manager.js
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorials/ad_monetization.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ Let's register a simple listener to Shaka's AD_STARTED event. It will log the
start of the ad in the console.

```js
adManager.addEventListener(shaka.ads.AdManager.AD_STARTED, () => {
adManager.addEventListener(shaka.ads.Utils.AD_STARTED, () => {
console.log('An ad has started');
});
```
Expand All @@ -235,7 +235,7 @@ that requires access to those, here is how to get them:
// Note that unlike in the previous example, we are capturing the AD_STARTED
// event object here (the "e" parameter of the lambda function) so we can access
// its properties.
adManager.addEventListener(shaka.ads.AdManager.AD_STARTED, (e) => {
adManager.addEventListener(shaka.ads.Utils.AD_STARTED, (e) => {
const sdkAdObject = e['sdkAdObject'];
const originalEvent = e['originalEvent'];
});
Expand All @@ -250,11 +250,11 @@ Client Side or the {@link shaka.ads.AdManager#event:ImaStreamManagerLoadedEvent}
for Server Side to get the IMA [AdManager][] or [StreamManager][] objects.

```js
adManager.addEventListener(shaka.ads.AdManager.IMA_AD_MANAGER_LOADED, (e) => {
adManager.addEventListener(shaka.ads.Utils.IMA_AD_MANAGER_LOADED, (e) => {
const imaAdManager = e['imaAdManager'];
});

adManager.addEventListener(shaka.ads.AdManager.IMA_STREAM_MANAGER_LOADED, (e) => {
adManager.addEventListener(shaka.ads.Utils.IMA_STREAM_MANAGER_LOADED, (e) => {
const imaStreamManager = e['imaStreamManager'];
});
```
Expand Down
Loading

0 comments on commit e39defb

Please sign in to comment.