Wait for isReady before js exec (#701)
This commit is contained in:
parent
20761bea00
commit
7b48e4e9d2
@ -108,7 +108,7 @@ class App extends React.PureComponent<Props, State> {
|
||||
);
|
||||
}
|
||||
|
||||
private runJs = (): void => {
|
||||
private runJs = async (): Promise<void> => {
|
||||
const { api } = this.props;
|
||||
const { code } = this.state;
|
||||
const { keyring } = uiKeyring;
|
||||
@ -129,6 +129,8 @@ class App extends React.PureComponent<Props, State> {
|
||||
window: null
|
||||
};
|
||||
|
||||
await this.injected.api.isReady;
|
||||
|
||||
// squash into a single line so exceptions (with linenumbers) maps to the same line/origin
|
||||
// as we have in the editor view (TODO: Make the console.error here actually return the full stack)
|
||||
const exec = `(async ({${Object.keys(this.injected).join(',')}}) => { try { ${code} } catch (error) { console.error(error); } })(injected);`;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user