diff --git a/demo/benchmarks.html b/demo/benchmarks.html deleted file mode 100644 index 0634cb4..0000000 --- a/demo/benchmarks.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - arcade-machine-react - - - -
- - - - - diff --git a/demo/components/FocusBenchmarks.tsx b/demo/components/FocusBenchmarks.tsx deleted file mode 100644 index b5ca8f5..0000000 --- a/demo/components/FocusBenchmarks.tsx +++ /dev/null @@ -1,132 +0,0 @@ -import * as React from 'react'; -import { Suite, Event } from 'benchmark'; -import { IBenchmark, benchmarks } from './benchmarks'; - -declare const Benchmark: any; - -/** - * BenchmarkRow is rendered for each element in the list of benchmarks. - */ -export class BenchmarkRow extends React.Component< - { case: IBenchmark }, - { result: string; running: boolean } -> { - private readonly fixtureRef = React.createRef(); - - public state = { result: '', running: false }; - - private runSelf = () => { - const suite = new Benchmark.Suite(); - this.addTestCase(suite); - suite.run({ async: true }); - }; - - public addTestCase(suite: Suite) { - const { name, setup, iterate } = this.props.case; - const state = { container: this.fixtureRef.current! }; - - this.setState({ result: 'queued...' }); - - let setupResult: any; - let didRun = false; - let previous: any; - suite.add( - name, - () => { - if (!didRun) { - this.setState({ result: 'running', running: true }); - setupResult = setup ? setup(state) : null; - didRun = true; - } - - previous = iterate(state, setupResult, previous); - }, - { - onComplete: (ev: Event) => { - const target: any = ev.target; - if (target.error) { - this.setState({ result: target.error.toString(), running: false }); - return; - } - - this.setState({ - running: false, - result: `${Math.round(target.hz)} ops/sec ± ${target.stats.rme.toFixed(2)} (${( - target.stats.mean * 1000 - ).toFixed(3)}ms each)`, - }); - }, - }, - ); - } - - public render() { - return ( - - {this.props.case.name} - {this.state.running ? : null} - - {this.state.result} -
- - - - ); - } -} - -/** - * Benchmarks is the table of runnable benchmarks. - */ -export class Benchmarks extends React.Component<{}, { running: boolean }> { - public state = { running: false }; - - private readonly benchmarkRows: React.RefObject[] = benchmarks.map(() => - React.createRef(), - ); - - private runAll = () => { - const suite = new Benchmark.Suite(); - - this.benchmarkRows.forEach(row => { - row.current!.addTestCase(suite); - }); - - suite.on('complete', () => { - this.setState({ running: false }); - }); - - suite.run({ async: true }); - }; - - public render() { - return ( - -

Benchmarks

-
- - - - - - - - - - {benchmarks.map((benchmark, i) => ( - - ))} - -
BenchmarkDOM Fixture - Result{' '} - -
-
-
- ); - } -} diff --git a/demo/components/FocusFormDemo.tsx b/demo/components/FocusFormDemo.tsx deleted file mode 100644 index d381335..0000000 --- a/demo/components/FocusFormDemo.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import * as React from 'react'; - -export const FocusFormDemo = () => ( - -

A Form

-
-
-
- -
-
- -
-
-