MCPcopy
hub / github.com/dollarshaveclub/postmate / resolveOrigin

Function resolveOrigin

src/postmate.js:37–43  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

35 * @return {String} The URLs origin
36 */
37export const resolveOrigin = (url) => {
38 const a = document.createElement('a')
39 a.href = url
40 const protocol = a.protocol.length > 4 ? a.protocol : window.location.protocol
41 const host = a.host.length ? ((a.port === '80' || a.port === '443') ? a.hostname : a.host) : window.location.host
42 return a.origin || `${protocol}//${host}`
43}
44
45const messageTypes = {
46 handshake: 1,

Callers 2

test.postmate.jsFile · 0.90
sendHandshakeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected