Skip to content

Commit 4c61092

Browse files
committed
New onDuckPlayerScriptsReady event
1 parent 2f27f96 commit 4c61092

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

injected/src/features/duck-player.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ export default class DuckPlayerFeature extends ContentFeature {
6565
*/
6666
if (isBeingFramed()) return;
6767

68+
/**
69+
* TODO: Remove this when ready to re-enable Duck Player classic
70+
*/
71+
console.warn('Not initializing Duck Player classic');
72+
return;
73+
6874
/**
6975
* Just the 'overlays' part of the settings object.
7076
* @type {import("@duckduckgo/privacy-configuration/schema/features/duckplayer").DuckPlayerSettings['overlays']}

injected/src/features/duckplayer-native/constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ export const MSG_NAME_MUTE_AUDIO = 'onMuteAudio';
55
export const MSG_NAME_SERP_NOTIFY = 'onSerpNotify';
66
export const MSG_NAME_YOUTUBE_ERROR = 'onYoutubeError';
77
export const MSG_NAME_URL_CHANGE = 'onUrlChanged';
8-
export const MSG_NAME_FEATURE_READY = 'onDuckPlayerReady';
8+
export const MSG_NAME_FEATURE_READY = 'onDuckPlayerFeatureReady';
9+
export const MSG_NAME_SCRIPTS_READY = 'onDuckPlayerScriptsReady';

injected/src/features/duckplayer-native/duckplayer-native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export class DuckPlayerNative {
9696
this.onLoad(this.sideEffects, this.logger);
9797
}
9898

99-
this.messages.notifyFeatureIsReady();
99+
this.messages.notifyScriptIsReady();
100100
}
101101
}
102102

injected/src/features/duckplayer-native/messages.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,18 @@ export class DuckPlayerNativeMessages {
9797
}
9898

9999
/**
100-
* Notifies browser that the feature
100+
* Notifies browser that the feature is ready
101101
*/
102102
notifyFeatureIsReady() {
103-
console.log('FIRING ONDUCKPLAYERREADY');
103+
console.log('FIRING', constants.MSG_NAME_FEATURE_READY);
104104
this.messaging.notify(constants.MSG_NAME_FEATURE_READY, {});
105105
}
106+
107+
/**
108+
* Notifies browser that scripts are ready to be acalled
109+
*/
110+
notifyScriptIsReady() {
111+
console.log('FIRING', constants.MSG_NAME_SCRIPTS_READY);
112+
this.messaging.notify(constants.MSG_NAME_SCRIPTS_READY, {});
113+
}
106114
}

messaging/lib/webkit.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ export class WebkitMessagingTransport {
154154
* @param {import('../index.js').RequestMessage} msg
155155
*/
156156
async request(msg) {
157+
console.log('MESSAGE', msg);
157158
const data = await this.wkSendAndWait(msg.context, msg);
158159

159160
if (isResponseFor(msg, data)) {

0 commit comments

Comments
 (0)