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

Move messaging.js to NPM package #9547

Merged
merged 9 commits into from May 31, 2017
Merged

Move messaging.js to NPM package #9547

merged 9 commits into from May 31, 2017

Conversation

chenshay
Copy link
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
@@ -14,7 +14,7 @@
* limitations under the License.
*/

import {Messaging, WindowPortEmulator, parseMessage} from './messaging';
import {Messaging, WindowPortEmulator, parseMessage} from 'messaging';
Copy link
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
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
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
@@ -58,9 +55,10 @@ export function parseMessage(message) {
if (message.charAt(0) != '{') {
return null;
}
return /** @type {?Message} */ (tryParseJson(message) || null);
return /** @type {?Message} */ (JSON.parse(/** @type {string} */ (message)));
Copy link
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
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
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
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
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