Skip to content

Commit 63a6460

Browse files
Export SDK internals for dev mode
1 parent f1de8a8 commit 63a6460

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@splitsoftware/splitio-commons",
3-
"version": "2.4.1",
3+
"version": "2.4.2-rc.0",
44
"description": "Split JavaScript SDK common components",
55
"main": "cjs/index.js",
66
"module": "esm/index.js",

src/sdkClient/sdkClient.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export function sdkClientFactory(params: ISdkFactoryContext, isSharedClient?: bo
4848

4949
// Sdk destroy
5050
{
51+
__ctx: params,
5152
flush() {
5253
// @TODO define cooldown time
5354
return __cooldown(__flush, COOLDOWN_TIME_IN_MILLIS);

src/sdkFactory/index.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ export function sdkFactory(params: ISdkFactoryParams): SplitIO.ISDK | SplitIO.IA
107107

108108
log.info(NEW_FACTORY);
109109

110-
// @ts-ignore
111-
return objectAssign({
110+
const factory = objectAssign({
112111
// Split evaluation and event tracking engine
113112
client: clientMethod,
114113

@@ -126,6 +125,17 @@ export function sdkFactory(params: ISdkFactoryParams): SplitIO.ISDK | SplitIO.IA
126125
destroy() {
127126
hasInit = false;
128127
return Promise.all(Object.keys(clients).map(key => clients[key].destroy())).then(() => { });
129-
}
128+
},
129+
130+
__ctx: ctx
130131
}, extraProps && extraProps(ctx), lazyInit ? { init } : init());
132+
133+
// append factory to global
134+
if (typeof window === 'object') { // @ts-ignore
135+
// eslint-disable-next-line no-undef
136+
(window.__HARNESS_FME__ = window.__HARNESS_FME__ || []).push(factory);
137+
}
138+
139+
// @ts-ignore
140+
return factory;
131141
}

0 commit comments

Comments
 (0)