More broadly, this just supports multiple profiles loaded into the editor in the same time, which supports import from profiles which are multithreaded by importing each thread as a different profile. For now, the only two file formats that support multiprocess import are Instruments .trace files and speedscope's own file format In the process of doing this, I refactored the container code considerably and extracted all the dispatch calls into containers rather than them being part of the non-container view code. This is nice because it means that views don't have to be aware of which Flamechart they are or which profile index is being operated upon. Fixes #66 Fixes #82 Fixes #91
28 lines
796 B
TypeScript
28 lines
796 B
TypeScript
import {h, render} from 'preact'
|
|
import {createApplicationStore} from './store'
|
|
import {Provider} from 'preact-redux'
|
|
import {ApplicationContainer} from './views/application-container'
|
|
|
|
console.log(`speedscope v${require('../package.json').version}`)
|
|
|
|
declare const module: any
|
|
if (module.hot) {
|
|
module.hot.dispose(() => {
|
|
// Force the old component go through teardown steps
|
|
render(<div />, document.body, document.body.lastElementChild || undefined)
|
|
})
|
|
module.hot.accept()
|
|
}
|
|
|
|
const lastStore: any = (window as any)['store']
|
|
const store = createApplicationStore(lastStore ? lastStore.getState() : {})
|
|
;(window as any)['store'] = store
|
|
|
|
render(
|
|
<Provider store={store}>
|
|
<ApplicationContainer />
|
|
</Provider>,
|
|
document.body,
|
|
document.body.lastElementChild || undefined,
|
|
)
|