-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(react): stop polluting lynx with lynxWorkletJsImpl(1/2)
- Loading branch information
Showing
13 changed files
with
88 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
// Copyright 2024 The Lynx Authors. All rights reserved. | ||
// Licensed under the Apache License Version 2.0 that can be found in the | ||
// LICENSE file in the root directory of this source tree. | ||
import { lynxWorkletJsImpl } from './jsImpl.js'; | ||
|
||
import { isMtsEnabled } from './functionality.js'; | ||
|
||
let initValuePatch: [number, unknown][] = []; | ||
const initValueIdSet = new Set<number>(); | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export function addWorkletRefInitValue(id: number, value: unknown): void { | ||
const impl = lynxWorkletJsImpl(); | ||
if (!impl) { | ||
if (!isMtsEnabled()) { | ||
return; | ||
} | ||
|
||
impl._workletRefInitValueSet.add(id); | ||
impl._workletRefInitValuePatch.push([id, value]); | ||
initValueIdSet.add(id); | ||
initValuePatch.push([id, value]); | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export function takeWorkletRefInitValuePatch(): [number, unknown][] { | ||
const impl = lynxWorkletJsImpl(false); | ||
if (!impl) { | ||
return []; | ||
} | ||
|
||
const res = impl._workletRefInitValuePatch; | ||
impl._workletRefInitValuePatch = []; | ||
const res = initValuePatch; | ||
initValuePatch = []; | ||
return res; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters