Skip to content

Commit 1fb270f

Browse files
committed
chore: release rc 7
Release-As: 1.0.0-rc.7
1 parent b3186d5 commit 1fb270f

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

README.md

+7-11
Original file line numberDiff line numberDiff line change
@@ -282,20 +282,16 @@ Miscellaneous:
282282
Plugins are plain old JavaScript objects with a simple interface that hooks
283283
into the lifecycle of Keat. Checkout [the common plugin interface on GitHub](https://github.com/WitoDelnat/keat/blob/main/src/core/plugin.ts) to get a full view on the available context and API.
284284

285-
Here is a simple example of a plugin that cycles to the next variate each second:
285+
Here is the code for the launch day plugin:
286286

287287
```typescript
288-
const cycle: Plugin = () => {
289-
let counter = 0;
290-
291-
return {
292-
onPluginInit() {
293-
setInterval(() => counter++, 1000);
294-
},
295-
onEval({ variates }, { setResult }) {
296-
setResult(variates[counter % variates.length]);
288+
export const launchDay = () => {
289+
createPlugin({
290+
matcher: isDate,
291+
evaluate({ literal }) {
292+
return literal.getTime() < Date.now();
297293
},
298-
};
294+
});
299295
};
300296
```
301297

src/plugins/launchDay.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createPlugin, isDate } from "../core";
22

3-
export const lauchDay = () => {
3+
export const launchDay = () => {
44
createPlugin({
55
matcher: isDate,
66
evaluate({ literal }) {

src/plugins/posthog.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import posthogUpstream, { PostHog, PostHogConfig } from "posthog-js";
22
import { flagsToConfig } from "../core";
3-
import { isAny, isNone } from "../core/matchers";
3+
import { isAny } from "../core/matchers";
44
import { createPlugin } from "../core/plugin";
55

66
export const posthog = (
@@ -12,7 +12,6 @@ export const posthog = (
1212
return createPlugin({
1313
onPluginInit: async ({ variates }, { setConfig, onChange }) => {
1414
return new Promise<void>((r) => {
15-
console.log("START");
1615
if (typeof apiTokenOrClient === "string") {
1716
client = posthogUpstream;
1817
client.init(apiTokenOrClient, {
@@ -24,6 +23,7 @@ export const posthog = (
2423
} else {
2524
client = apiTokenOrClient;
2625
}
26+
2727
client.onFeatureFlags((_, flags) => {
2828
const config = flagsToConfig(flags, variates);
2929
setConfig(config);
@@ -37,7 +37,6 @@ export const posthog = (
3737
},
3838
matcher: isAny,
3939
evaluate({ feature, variate }) {
40-
console.log("eval", feature, variate, client.getFeatureFlag(feature));
4140
return variate === client.getFeatureFlag(feature);
4241
},
4342
});

0 commit comments

Comments
 (0)