Implement sending messages to server add-on

Reviewed By: mweststrate

Differential Revision: D34073403

fbshipit-source-id: eacd73811b436f2b5c4255a83d8eb09367a96a67
This commit is contained in:
Andrey Goncharov
2022-02-28 03:50:34 -08:00
committed by Facebook GitHub Bot
parent 12151e4a71
commit 842b2c810a
5 changed files with 133 additions and 10 deletions

View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export const safeJSONStringify = (data: unknown): string => {
try {
return JSON.stringify(data);
} catch {
return 'Unable to serialize';
}
};