Use strict equality.

This commit is contained in:
Richard Lewis 2017-12-01 16:39:07 +00:00
parent 9dabf19d1b
commit dd7358cbb4

View file

@ -155,7 +155,7 @@ function addEndpoint(widgetId, endpointUrl) {
const endpoint = new WidgetMessageEndpoint(widgetId, endpointUrl); const endpoint = new WidgetMessageEndpoint(widgetId, endpointUrl);
if (messageEndpoints && messageEndpoints.length > 0) { if (messageEndpoints && messageEndpoints.length > 0) {
if (messageEndpoints.filter(function(ep) { if (messageEndpoints.filter(function(ep) {
return (ep.widgetId == widgetId && ep.endpointUrl == endpointUrl); return (ep.widgetId === widgetId && ep.endpointUrl === endpointUrl);
}).length > 0) { }).length > 0) {
// Message endpoint already registered // Message endpoint already registered
return; return;
@ -204,18 +204,18 @@ function onMessage(event) {
const action = event.data.action; const action = event.data.action;
const widgetId = event.data.widgetId; const widgetId = event.data.widgetId;
if (action == 'content_loaded') { if (action === 'content_loaded') {
dis.dispatch({ dis.dispatch({
action: 'widget_content_loaded', action: 'widget_content_loaded',
widgetId: widgetId, widgetId: widgetId,
}); });
sendResponse(event, {success: true}); sendResponse(event, {success: true});
} else if (action == 'supported_api_versions') { } else if (action === 'supported_api_versions') {
sendResponse(event, { sendResponse(event, {
api: "widget", api: "widget",
supported_versions: SUPPORTED_WIDGET_API_VERSIONS, supported_versions: SUPPORTED_WIDGET_API_VERSIONS,
}); });
} else if (action == 'api_version') { } else if (action === 'api_version') {
sendResponse(event, { sendResponse(event, {
api: "widget", api: "widget",
version: WIDGET_API_VERSION, version: WIDGET_API_VERSION,