{"_id":"framesg","_rev":"37-0b5ac2e46ccc4e30ed6f67224f5b82c5","name":"framesg","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"framesg","version":"0.1.0","keywords":["iframe","message","promise","request"],"author":{"name":"dev@mixpanel.com"},"license":"MIT","_id":"framesg@0.1.0","maintainers":[{"name":"tdumitrescu","email":"webdev@cmme.org"}],"homepage":"https://github.com/mixpanel/framesg#readme","bugs":{"url":"https://github.com/mixpanel/framesg/issues"},"dist":{"shasum":"66806a670f6db45c6bb7707737840a23ddaaefd6","tarball":"https://registry.npmjs.org/framesg/-/framesg-0.1.0.tgz","integrity":"sha512-Ff2r1p4tIL0d+ynpjxr0DDM5Nxj2i6yapK9eK8dPzpXFuMMJ0Soz5f38NfKQLQ9TZV23UHYLd7GXV9gGMQ9lKQ==","signatures":[{"sig":"MEQCIGeXplhXYaSpvy3SVW042qAO0aO5a7+5tTSNDbgNW0rVAiBvUl9f/tQkVKT1pgND5eGUqBROxARRhD8BTjt5BtRCsw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"build/index.js","_from":".","_shasum":"66806a670f6db45c6bb7707737840a23ddaaefd6","gitHead":"16468363810f1c3596e236de9281386f492339e4","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"babel lib -d build","prepublish":"npm run build"},"_npmUser":{"name":"tdumitrescu","email":"webdev@cmme.org"},"repository":{"url":"git+ssh://git@github.com/mixpanel/framesg.git","type":"git"},"_npmVersion":"2.14.12","description":"request/response-style communication to/from iframes","directories":{},"_nodeVersion":"4.3.1","devDependencies":{"babel-cli":"^6.6.5","babel-preset-es2015":"^6.6.0"},"_npmOperationalInternal":{"tmp":"tmp/framesg-0.1.0.tgz_1458285039410_0.6090501532889903","host":"packages-13-west.internal.npmjs.com"}},"0.1.1":{"name":"framesg","version":"0.1.1","keywords":["iframe","message","promise","request"],"author":{"name":"dev@mixpanel.com"},"license":"MIT","_id":"framesg@0.1.1","maintainers":[{"name":"mixpanel","email":"dev@mixpanel.com"},{"name":"tdumitrescu","email":"webdev@cmme.org"}],"homepage":"https://github.com/mixpanel/framesg#readme","bugs":{"url":"https://github.com/mixpanel/framesg/issues"},"dist":{"shasum":"1d8bef3f0bce1238a155f1fae17f3c0faa347144","tarball":"https://registry.npmjs.org/framesg/-/framesg-0.1.1.tgz","integrity":"sha512-2L7/cfxRpjovgEkItceqeM+olEoAaDdi+A9nTpxBNFrNp6kIImynJHRqNUy6+owIfqg9QGuk4gsO0wif/AUTjw==","signatures":[{"sig":"MEYCIQCR6zkhOi4EGxrvDPTPPu5hRNp9EW2TUPSGGLLEINlrxwIhANxzEukMU7BpL7rWfQSIG5QJZ82xsT9GETt2nBfeqRkb","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"build/index.js","_from":".","_shasum":"1d8bef3f0bce1238a155f1fae17f3c0faa347144","gitHead":"0b1f3f37a5aa30ab0d2dedd63700a92dfefc518a","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"babel lib -d build","prepublish":"npm run build"},"_npmUser":{"name":"tdumitrescu","email":"webdev@cmme.org"},"repository":{"url":"git+ssh://git@github.com/mixpanel/framesg.git","type":"git"},"_npmVersion":"2.14.12","description":"request/response communication to/from iframes","directories":{},"_nodeVersion":"4.3.1","devDependencies":{"babel-cli":"^6.6.5","babel-preset-es2015":"^6.6.0"},"_npmOperationalInternal":{"tmp":"tmp/framesg-0.1.1.tgz_1458328607169_0.7344767162576318","host":"packages-13-west.internal.npmjs.com"}},"0.1.2":{"name":"framesg","version":"0.1.2","keywords":["iframe","message","promise","request"],"author":{"name":"dev@mixpanel.com"},"license":"MIT","_id":"framesg@0.1.2","maintainers":[{"name":"mixpanel","email":"dev@mixpanel.com"},{"name":"tdumitrescu","email":"webdev@cmme.org"}],"homepage":"https://github.com/mixpanel/framesg#readme","bugs":{"url":"https://github.com/mixpanel/framesg/issues"},"dist":{"shasum":"5b7a7f146e8bc375cc32fd319e23e209be387ed3","tarball":"https://registry.npmjs.org/framesg/-/framesg-0.1.2.tgz","integrity":"sha512-iAc9SwRC/UvAguU/E9+43Dv5BmAL0/PVmXrNzP5VzWhgA9vqJ+4DC2pTMzYP1EDoNY3LOOOIFeiYcTQym3/BRQ==","signatures":[{"sig":"MEUCIBboXOyGrWC+53gsUu/qdLaw/FvzgRfzG4cedfRty7HEAiEAgygZZXgWT6yyWuimtidmWqxI9/4ArYBBYNne0HlXDFA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"build/index.js","_from":".","_shasum":"5b7a7f146e8bc375cc32fd319e23e209be387ed3","gitHead":"70f35e0d49d765190fbb836afd320e20c43089bc","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"babel lib -d build","prepublish":"npm run build"},"_npmUser":{"name":"tdumitrescu","email":"webdev@cmme.org"},"repository":{"url":"git+ssh://git@github.com/mixpanel/framesg.git","type":"git"},"_npmVersion":"2.14.12","description":"request/response communication to/from iframes","directories":{},"_nodeVersion":"4.3.1","devDependencies":{"babel-cli":"^6.6.5","babel-preset-es2015":"^6.6.0"},"_npmOperationalInternal":{"tmp":"tmp/framesg-0.1.2.tgz_1458451578163_0.20241765957325697","host":"packages-13-west.internal.npmjs.com"}},"0.1.3":{"name":"framesg","version":"0.1.3","keywords":["iframe","message","promise","request"],"author":{"name":"dev@mixpanel.com"},"license":"MIT","_id":"framesg@0.1.3","maintainers":[{"name":"mixpanel","email":"dev@mixpanel.com"},{"name":"tdumitrescu","email":"webdev@cmme.org"}],"homepage":"https://github.com/mixpanel/framesg#readme","bugs":{"url":"https://github.com/mixpanel/framesg/issues"},"dist":{"shasum":"8e0701e529d11478bbbab1e8af9dae68ee353df3","tarball":"https://registry.npmjs.org/framesg/-/framesg-0.1.3.tgz","integrity":"sha512-BFVLhSqYx7/9GujjdiiQyPzpBW5BIli2r8CMGTEQFzHLGc5rPqDniAZASvD0zqkRqA8jDPpojmGScMrUlUh3RQ==","signatures":[{"sig":"MEUCIQCWSZ7BHFPjrX0Rmi1qoy6BBZhlQnCX+IpmI8fiFAJemQIgfGe2gNqa07vRMq/c1Sp5Mlh2NU8/qmFAChsNnQ+IG5A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"build/index.js","_from":".","_shasum":"8e0701e529d11478bbbab1e8af9dae68ee353df3","gitHead":"efb46fde0e05331e0a277be85f0539f83138d218","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"babel lib -d build","prepublish":"npm run build"},"_npmUser":{"name":"tdumitrescu","email":"webdev@cmme.org"},"repository":{"url":"git+ssh://git@github.com/mixpanel/framesg.git","type":"git"},"_npmVersion":"2.14.12","description":"request/response communication to/from iframes","directories":{},"_nodeVersion":"4.3.1","devDependencies":{"babel-cli":"^6.6.5","babel-preset-es2015":"^6.6.0"},"_npmOperationalInternal":{"tmp":"tmp/framesg-0.1.3.tgz_1460155468085_0.28790235333144665","host":"packages-12-west.internal.npmjs.com"}}},"time":{"created":"2016-03-18T07:10:39.806Z","modified":"2026-05-22T15:58:09.502Z","0.1.0":"2016-03-18T07:10:39.806Z","0.1.1":"2016-03-18T19:16:47.690Z","0.1.2":"2016-03-20T05:26:18.650Z","0.1.3":"2016-04-08T22:44:30.414Z"},"bugs":{"url":"https://github.com/mixpanel/framesg/issues"},"author":{"name":"dev@mixpanel.com"},"license":"MIT","homepage":"https://github.com/mixpanel/framesg#readme","keywords":["iframe","message","promise","request"],"repository":{"url":"git+ssh://git@github.com/mixpanel/framesg.git","type":"git"},"description":"request/response communication to/from iframes","maintainers":[{"email":"dev@mixpanel.com","name":"mixpanel-dev"},{"email":"webdev@cmme.org","name":"tdumitrescu"},{"email":"joshua.thong@mixpanel.com","name":"mp_jthong"},{"email":"rahul.raveendran@mixpanel.com","name":"rahul-mixpanel"},{"email":"ketan.shikhare@mixpanel.com","name":"ketanmixpanel"},{"email":"sonya.park@mixpanel.com","name":"sonya-park-mp"},{"email":"mark.siebert@mixpanel.com","name":"msiebert-mixpanel"},{"email":"tyler.roach@mixpanel.com","name":"tyler_mixpanel"},{"email":"jakub.grzegorzewski@mixpanel.com","name":"jakub.grz"},{"email":"jared@mixpanel.com","name":"jaredcmixpanel"}],"readme":"# framesg\n\nTalk to iframes sanely. Framesg manages request/response cycles on top of `window.postMessage` with ES2015 Promises.\n\n## Installation\n\nInstall via `npm`, for packaging with a bundler such as `Webpack` or `Browserify`:\n\n    npm install --save framesg\n\nIf your target environment does not supply `Promise` natively, provide it with any A+\\-compliant implementation such as [Bluebird](http://bluebirdjs.com/).\n\n## Usage\n\nRegister handlers with a target window, e.g., the parent of the current iframe:\n```javascript\nimport Framesg from 'framesg';\nconst parentFrame = new Framesg(window.parent, 'my-app', {\n\n  sayHello: username => alert(`Hello ${username}!`),\n\n  getUserInfo: userID => userInfo[userID], // response to caller\n\n});\n```\nThe first argument is the window/iframe to communicate with (typically `window.parent` within an iframe, and `iframeEl.contentWindow` within a parent where `iframeEl` is the iframe's DOM element). The second argument (`'my-app'` in the example above) is a user-supplied namespace. The third argument is an object mapping endpoint names to handler functions.\n\nSend a message to another frame:\n```javascript\nparentFrame.send('getWidgetInfo', widgetID)\n  .then(widgetInfo => console.log(widgetInfo))\n  .catch(err => console.error(`Error getting widget info: ${err}`));\n```\n`send` returns a promise, which is resolved with the response value from the other frame.\n\nIf a handler returns a promise rather than an immediate value, the response message is only sent to the other frame when the promise is resolved or rejected, which is useful for asynchronous actions:\n```javascript\nconst childFrame = new Framesg(iframeEl.contentWindow, 'my-app', {\n\n  fetchWombatInfo: wombatID => new Promise((resolve, reject) =>\n    makeLegacyWombatApiCall(\n      function success(wombatInfo) { resolve(wombatInfo); },\n      function error(errorMsg) { reject(errorMsg); }\n    )\n  ),\n\n});\n```\n\nMore handlers can be added after initialization:\n```javascript\nparentFrame.addHandler('marco', () => 'polo');\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}