- Notifications
You must be signed in to change notification settings - Fork0
Communicate between iframes and application
NotificationsYou must be signed in to change notification settings
cristiantela/iframessa
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Package to communicate between iframes and application.
npm install iframessa
<iframesrc="about.html"name="about"></iframe>
constiframessa=require('iframessa');iframessa.getter('userName',({ data, sender})=>{return'Matheus Cristian';});
constiframessa=require('iframessa');iframessa.register('about');iframessa.get('userName').then(({ data, sender})=>{console.log(data);// Matheus Cristianconsole.log(sender);// parent object},data);
constiframessa=require('iframessa');iframessa.emit('action','logout');
This will emit a'action'
event to your parent with the data'logout'
.Note that the data can be an object as well.
constiframessa=require('iframessa');iframessa.on('action',({ data, sender})=>{console.log(data);// logout});
You can emit something to a specific child window withiframessa.modules.about.emit(event, data);
About
Communicate between iframes and application
Topics
Resources
Stars
Watchers
Forks
Packages0
No packages published