Skip to content

feat: New features and deprecations#90

Merged
rzane merged 28 commits into
mainfrom
rzane/api-changes
Jan 9, 2026
Merged

feat: New features and deprecations#90
rzane merged 28 commits into
mainfrom
rzane/api-changes

Conversation

@rzane

@rzane rzane commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

This PR intends to deprecate a lot of confusing functionality in this library, and behave more like https://github.com/Betterment/test_track_dart_client.

Changes

Old API (deprecated, but still works)

import TestTrack from 'test_track_js_client';

await TestTrack.initialize();

// Promise<void>
await TestTrack.vary('button_color', {
  context: 'homepage',
  defaultVariant: 'blue',
  variants: {
    blue: () => console.log('blue'),
    red: () => console.log('red')
  }
});

// Promise<void>
await TestTrack.ab('new_feature', {
  context: 'homepage',
  callback: (enabled) => console.log(enabled)
});

New API

import * as TestTrack from 'test_track_js_client';

const testTrack = await TestTrack.initialize();

// string
const color = testTrack.vary('button_color', { context: 'homepage', defaultVariant: 'blue' });
console.log(color)

// boolean
const enabled = testTrack.ab('new_feature', { context: 'homepage' });
console.log(enabled);

Breaking Changes

  • Named exports: Use import * as TestTrack or import { initialize } instead of default import
  • Web extension: Connecting to the web extension happens when you call initialize() instead of at import-time.

Base automatically changed from rzane/move-split-registry to main January 9, 2026 18:49
@rzane rzane force-pushed the rzane/api-changes branch from 6d425b0 to a714190 Compare January 9, 2026 18:50
@rzane rzane marked this pull request as ready for review January 9, 2026 18:51

@samandmoore samandmoore left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

domainlgtm platformlgtm

@rzane rzane merged commit 57b26ac into main Jan 9, 2026
5 checks passed
@rzane rzane deleted the rzane/api-changes branch January 9, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants