Skip to content

Commit 16f61c9

Browse files
committed
feat: pass promise to crender function
1 parent 4615cf3 commit 16f61c9

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export type State = {
88
loading: boolean,
99
loaded: boolean,
1010
error: ?Error,
11+
promise: ?Promise<any>,
1112
}
1213

1314
export type Props = {

src/loadScript.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,17 @@ export default (props: Props): Promise<any> =>
3939
}
4040
))
4141

42-
export function getState({src}: Props): {loading: boolean, loaded: boolean, error: ?Error} {
42+
export function getState({src}: Props): {
43+
loading: boolean,
44+
loaded: boolean,
45+
error: ?Error,
46+
promise: ?Promise<any>,
47+
} {
4348
const result = results[src]
4449
return {
4550
loading: result == null,
4651
loaded: result ? !result.error : false,
4752
error: result && result.error,
53+
promise: promises[src],
4854
}
4955
}

0 commit comments

Comments
 (0)