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

Convert all of web-ext promise chains to coroutines #72

Closed
kumar303 opened this issue Feb 26, 2016 · 2 comments
Closed

Convert all of web-ext promise chains to coroutines #72

kumar303 opened this issue Feb 26, 2016 · 2 comments

Comments

@kumar303
Copy link
Contributor

All code that currently builds chains of promises would be way more concise using co. Let's rewrite it!

Example of rewriting test code:

it('zips a package', () => withTempDir(
  (tmpDir) =>
     co(function*() {
       let zipFile = new ZipFile();

       let {extensionPath} = yield adapter.buildMinimalExt(tmpDir);
       assert.match(extensionPath, /minimal_extension-1\.0\.xpi$/);

       yield zipFile.open(extensionPath);

       let fileNames = [];
       let result = yield zipFile.readEach((entry) => fileNames.push(entry.fileName));

       assert.deepEqual(fileNames, ['manifest.json']);

       return result;
     })
));
@kumar303
Copy link
Contributor Author

I'm not totally sure if this is possible in babel since we'd like to support older system nodes and also running without a --harmony flag. Some things to dig into:

@kumar303
Copy link
Contributor Author

We totally did this in #411 !

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

No branches or pull requests

1 participant