Skip to content

Move messaging.js to NPM package#9547

Merged
chenshay merged 9 commits intoampproject:masterfrom
chenshay:npm
May 31, 2017
Merged

Move messaging.js to NPM package#9547
chenshay merged 9 commits intoampproject:masterfrom
chenshay:npm

Conversation

@chenshay
Copy link
Copy Markdown
Contributor

@chenshay chenshay commented May 25, 2017

@chenshay chenshay added this to the Sprint H2 May milestone May 25, 2017
@chenshay chenshay requested a review from dvoytenko May 25, 2017 15:47
*/

import {Messaging, WindowPortEmulator, parseMessage} from './messaging';
import {Messaging, WindowPortEmulator, parseMessage} from 'messaging';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you explain how "messaging" name here is getting resolved? Also, what will this look like when imported from the "amp-viewer" repo?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it's going to be taken straight from the file itself (not from npm)

@muxin
Copy link
Copy Markdown
Contributor

muxin commented May 25, 2017

shouldn't we be adding milestones to issues only?

@chenshay chenshay removed this from the Sprint H2 May milestone May 26, 2017
@chenshay chenshay requested a review from erwinmombay May 26, 2017 00:16
return null;
}
return /** @type {?Message} */ (tryParseJson(message) || null);
return /** @type {?Message} */ (JSON.parse(/** @type {string} */ (message)));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a big change - the previous version failed silently. You should probably preserve that. Anyone can send a message and it's not guaranteed to be what we expect. So it's best to shield ourselves and overspam error logs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Messaging,
WindowPortEmulator,
parseMessage,
} from '../messaging/messaging.js';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No ".js" in imports.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@dvoytenko
Copy link
Copy Markdown
Contributor

@chenshay Could you pls also reference the PR for amp-viewer project in the description of this PR?

@chenshay chenshay force-pushed the npm branch 2 times, most recently from 6ac9dcc to 9b3e477 Compare May 30, 2017 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create npm package for viewer messaging

5 participants