-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
66 additions
and
12 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
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,8 +1,10 @@ | ||
import { testChoreographer } from './test/TestChoreographer' | ||
import { testHybridObject } from './test/TestHybridObject' | ||
|
||
export * from './FilamentView' | ||
|
||
const TEST_HYBRID_OBJECT = true | ||
if (__DEV__ && TEST_HYBRID_OBJECT) { | ||
testHybridObject() | ||
testChoreographer().catch(console.error) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { FilamentProxy } from '../native/FilamentProxy' | ||
|
||
function timeout(ms: number): Promise<void> { | ||
return new Promise((resolve) => { | ||
setTimeout(() => resolve(), ms) | ||
}) | ||
} | ||
|
||
export async function testChoreographer() { | ||
console.log('Creating Choreographer...') | ||
const choreographer = FilamentProxy.createChoreographer() | ||
console.log('Created Choreographer!', choreographer, 'Adding onFrame listener...') | ||
|
||
let calls = 0 | ||
choreographer.addOnFrameListener((timestamp) => { | ||
console.log(`Choreographer::onFrame(${timestamp})`) | ||
calls++ | ||
}) | ||
choreographer.start() | ||
await timeout(500) | ||
console.log(`onFrame called ${calls} times in 500ms! Stopping...`) | ||
const finalCalls = calls | ||
choreographer.stop() | ||
await timeout(500) | ||
if (finalCalls > calls) { | ||
throw new Error(`Choreographer::onFrame has been called ${finalCalls - calls} times after stoppingg!`) | ||
} | ||
console.log('Choreographer successfully stopped!') | ||
} |