Skip to content

Commit 260329a

Browse files
shakyShanegithub-actions[bot]
authored andcommitted
Release build 4.21.1 [ci release]
1 parent a275d98 commit 260329a

File tree

17 files changed

+33243
-28561
lines changed

17 files changed

+33243
-28561
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ integration-test/extension/contentScope.js
66
integration-test/pages/build
77
packages/special-pages/pages/**/public
88
script-overload-snapshots/
9+
packages/special-pages/playwright-report/
10+
packages/special-pages/test-results/
11+
/playwright-report
12+
/test-results

Sources/ContentScopeScripts/dist/contentScope.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,6 +1328,47 @@
13281328
return parseJSONPointer(fromPointer);
13291329
}
13301330

1331+
/**
1332+
* @module Messaging
1333+
* @category Libraries
1334+
* @description
1335+
*
1336+
* An abstraction for communications between JavaScript and host platforms.
1337+
*
1338+
* 1) First you construct your platform-specific configuration (eg: {@link WebkitMessagingConfig})
1339+
* 2) Then use that to get an instance of the Messaging utility which allows
1340+
* you to send and receive data in a unified way
1341+
* 3) Each platform implements {@link MessagingTransport} along with its own Configuration
1342+
* - For example, to learn what configuration is required for Webkit, see: {@link WebkitMessagingConfig}
1343+
* - Or, to learn about how messages are sent and received in Webkit, see {@link WebkitMessagingTransport}
1344+
*
1345+
* ## Links
1346+
* Please see the following links for examples
1347+
*
1348+
* - Windows: {@link WindowsMessagingConfig}
1349+
* - Webkit: {@link WebkitMessagingConfig}
1350+
* - Schema: {@link "Messaging Schema"}
1351+
*
1352+
*/
1353+
1354+
/**
1355+
* Common options/config that are *not* transport specific.
1356+
*/
1357+
class MessagingContext {
1358+
/**
1359+
* @param {object} params
1360+
* @param {string} params.context
1361+
* @param {string} params.featureName
1362+
* @param {"production" | "development"} params.env
1363+
* @internal
1364+
*/
1365+
constructor (params) {
1366+
this.context = params.context;
1367+
this.featureName = params.featureName;
1368+
this.env = params.env;
1369+
}
1370+
}
1371+
13311372
/**
13321373
* @typedef {object} AssetConfig
13331374
* @property {string} regularFontUrl
@@ -1351,6 +1392,8 @@
13511392
#documentOriginIsTracker
13521393
/** @type {Record<string, unknown> | undefined} */
13531394
#bundledfeatureSettings
1395+
/** @type {MessagingContext} */
1396+
#messagingContext
13541397

13551398
/** @type {{ debug?: boolean, featureSettings?: Record<string, unknown>, assets?: AssetConfig | undefined, site: Site } | null} */
13561399
#args
@@ -1405,6 +1448,19 @@
14051448
return this.#bundledConfig
14061449
}
14071450

1451+
/**
1452+
* @returns {MessagingContext}
1453+
*/
1454+
get messagingContext () {
1455+
if (this.#messagingContext) return this.#messagingContext
1456+
this.#messagingContext = new MessagingContext({
1457+
context: 'contentScopeScripts',
1458+
featureName: this.name,
1459+
env: this.isDebug ? 'development' : 'production'
1460+
});
1461+
return this.#messagingContext
1462+
}
1463+
14081464
/**
14091465
* Get the value of a config setting.
14101466
* If the value is not set, return the default value.

0 commit comments

Comments
 (0)