typings / discussions

For discussions and issues with Typings or TypeScript definitions
7 stars 0 forks source link

Declaring a global variable #30

Closed sfali23 closed 8 years ago

sfali23 commented 8 years ago

Hello,

I am currently writing a typing for WebdriverIO.

WebdriverIO has two modes, standalone and wdio test runner based on mocha.

In standalone mode client is responsible for initializing and closing browser session and more over in standalone mode API works synchronously.

In wdio mode test runner will initialize and clean up browser object and API works asynchronously. This browser object available globally when run via test runner.

I have a working code for the standalone mode. My question is what can be done to make this global browser object available from typescript library.

I am seeing examples to make global module but not sure whether this is the best way to do it?

Thanks in advance.

Regards,

Farhan

blakeembrey commented 8 years ago

You would need to write the definition in "global" mode, which does not allow any top-level import or export. It may be possible to use UMD mode in TypeScript 2.0.

sfali23 commented 8 years ago

Sorry, completely forgot about this, this is what I thought as well, wanted to make sure.

Regards,

Farhan