Skip to content
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

Merged
merged 2 commits into from
Oct 17, 2018
Merged

Expose intializeRuntime timeout #71

merged 2 commits into from
Oct 17, 2018

Conversation

Thomas101
Copy link
Contributor

Expose timeout option to initializeRuntime as per discussion in kwonoj/hunspell-asm#145 (comment)

@codecov
Copy link

codecov bot commented Oct 15, 2018

Codecov Report

Merging #71 into 1.x will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@         Coverage Diff         @@
##            1.x    #71   +/-   ##
===================================
  Coverage   100%   100%           
===================================
  Files         6      6           
  Lines        57     57           
  Branches      9     10    +1     
===================================
  Hits         57     57
Impacted Files Coverage Δ
src/getModuleLoader.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 02e3d51...1c9d2d5. Read the comment docs.

@@ -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
Copy link
Owner

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> = {})

Copy link
Owner

@kwonoj kwonoj Oct 16, 2018

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>;

* @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
Copy link
Owner

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>)

Copy link
Contributor Author

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.

Copy link
Owner

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>;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you :-)

@codecov-io
Copy link

codecov-io commented Oct 17, 2018

Codecov Report

Merging #71 into 1.x will decrease coverage by 1.72%.
The diff coverage is 66.66%.

Impacted file tree graph

@@           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
Impacted Files Coverage Δ
src/getModuleLoader.ts 94.44% <66.66%> (-5.56%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 02e3d51...ee9928b. Read the comment docs.

@kwonoj kwonoj merged commit 0dc79ad into kwonoj:1.x Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants