Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
Coinflip experiment in WWW/JS
Browse files Browse the repository at this point in the history
Reviewed By: lacbs

Differential Revision: D49342225

fbshipit-source-id: e172135c5be77282f00eda777b7935d4b828276d
  • Loading branch information
On Saint Tiong authored and facebook-github-bot committed Sep 27, 2023
1 parent e072c6f commit 084a52c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions runtime/shared/FbtHooksImpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,26 @@ import type {
} from 'FbtHooks';
import typeof IntlViewerContext from 'IntlViewerContext';

import {coinflip} from 'Random';

import qex from 'qex';

const _registrations: FbtHookRegistrations = {};
const FbtHooksImpl = {
getErrorListener(context: FbtErrorContext): ?IFbtErrorListener {
return _registrations.errorListener?.(context);
},

logImpression(hash: string): void {
const coinflipValue = qex.getNumber(
'fbt_js_performance_testing',
'coinflip_value',
);

if (coinflipValue != null && coinflipValue !== 0) {
coinflip(coinflipValue);
}

_registrations.logImpression?.(hash);
},

Expand Down

0 comments on commit 084a52c

Please sign in to comment.