@nosnibor89/svelte-client-sdk 0.1.25 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/LDFlag.svelte
CHANGED
@@ -8,7 +8,7 @@ export type LDClientID = string;
|
|
8
8
|
export type LDFlags = LDFlagSet;
|
9
9
|
/** The LaunchDarkly instance */
|
10
10
|
export declare const LD: {
|
11
|
-
identify: (context: LDContext) => Promise<
|
11
|
+
identify: (context: LDContext) => Promise<LDFlagSet>;
|
12
12
|
flags: Readable<LDFlagSet>;
|
13
13
|
initialize: (clientId: LDClientID, context: LDContext, options?: LDOptions) => {
|
14
14
|
initializing: Writable<boolean>;
|
@@ -42,6 +42,7 @@ function toFlagsProxy(client, flags) {
|
|
42
42
|
* @returns {Object} The LaunchDarkly instance object.
|
43
43
|
*/
|
44
44
|
function createLD() {
|
45
|
+
console.log('instantiating client');
|
45
46
|
let coreLdClient;
|
46
47
|
const loading = writable(true);
|
47
48
|
const flagsWritable = writable({});
|
@@ -57,12 +58,14 @@ function createLD() {
|
|
57
58
|
coreLdClient.on('ready', () => {
|
58
59
|
loading.set(false);
|
59
60
|
const rawFlags = coreLdClient.allFlags();
|
61
|
+
// coreLdClient;
|
60
62
|
// const allFlags = toFlagsProxy(coreLdClient!, rawFlags);
|
61
63
|
const allFlags = rawFlags;
|
62
64
|
console.log('[LD] flag ready', rawFlags, allFlags);
|
63
65
|
flagsWritable.set(allFlags);
|
64
66
|
});
|
65
|
-
coreLdClient.on('change', () => {
|
67
|
+
coreLdClient.on('change', (context, changedFlags) => {
|
68
|
+
console.log('changed ctx', context, changedFlags);
|
66
69
|
const rawFlags = coreLdClient.allFlags();
|
67
70
|
// const allFlags = toFlagsProxy(coreLdClient!, rawFlags);
|
68
71
|
const allFlags = rawFlags;
|
@@ -80,7 +83,10 @@ function createLD() {
|
|
80
83
|
*/
|
81
84
|
async function identify(context) {
|
82
85
|
isClientInitialized(coreLdClient);
|
83
|
-
|
86
|
+
const allFlags = await coreLdClient.identify(context);
|
87
|
+
// const allFlags = toFlagsProxy(coreLdClient!, rawFlags);
|
88
|
+
flagsWritable.set(allFlags);
|
89
|
+
return allFlags;
|
84
90
|
}
|
85
91
|
/**
|
86
92
|
* Watches a flag for changes.
|
package/package.json
CHANGED