-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose intializeRuntime timeout #71
Conversation
Codecov Report
@@ Coverage Diff @@
## 1.x #71 +/- ##
===================================
Coverage 100% 100%
===================================
Files 6 6
Lines 57 57
Branches 9 10 +1
===================================
Hits 57 57
Continue to review full report at Codecov.
|
src/getModuleLoader.ts
Outdated
@@ -30,7 +30,8 @@ type runtimeModuleType = (moduleObject: StringMap) => AsmRuntimeType; | |||
type getModuleLoaderType = <T, R extends AsmRuntimeType>( | |||
factoryLoader: (runtime: R, environment: ENVIRONMENT) => T, | |||
runtimeModule: runtimeModuleType, | |||
module?: StringMap | |||
module?: StringMap, | |||
initializeOpts?: StringMap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make this to be strictly typed:
interface ModuleInitOption {
timeout: number
};
getModuleLoaderType(
... module?: StringMap,
initOptions: Partial<ModuleInitOption> = {})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here should be
type getModuleLoaderType = <T, R extends AsmRuntimeType>(
factoryLoader: (runtime: R) => T,
runtimeModule: runtimeModuleType,
module?: StringMap,
{timeout}?: Partial<ModuleInitOption>
) => moduleLoaderType<T>;
src/getModuleLoader.ts
Outdated
* @returns {moduleLoaderType<T>} Loader function | ||
*/ | ||
const getModuleLoader: getModuleLoaderType = <T, R extends AsmRuntimeType>( | ||
factoryLoader: (runtime: R, environment: ENVIRONMENT) => T, | ||
runtimeModule: runtimeModuleType, | ||
module?: StringMap | ||
module?: StringMap, | ||
initializeOpts?: StringMap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and we can destruct directrly:
(... {timeout}: Partial<ModuleInitOption>)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll have to excuse my absolute naivety on this, my typescript-foo is weak. Not too sure what I'm missing here...
module?: StringMap,
- initializeOpts?: StringMap
+ initOptions: (... {timeout}: Partial<ModuleInitOption>)
) => async (environment?: ENVIRONMENT) => {
src/getModuleLoader.ts(64,1): error TS1005: '=>' expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...
was just to skip rest of params, so what I meant was
type getModuleLoaderType = <T, R extends AsmRuntimeType>(
factoryLoader: (runtime: R, environment: ENVIRONMENT) => T,
runtimeModule: runtimeModuleType,
module?: StringMap,
{timeout}: Partial<InitOptions> = {}
) => moduleLoaderType<T>;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you :-)
Codecov Report
@@ Coverage Diff @@
## 1.x #71 +/- ##
========================================
- Coverage 100% 98.27% -1.73%
========================================
Files 6 6
Lines 57 58 +1
Branches 9 10 +1
========================================
Hits 57 57
- Partials 0 1 +1
Continue to review full report at Codecov.
|
Expose timeout option to initializeRuntime as per discussion in kwonoj/hunspell-asm#145 (comment)