safeframe
Version:
SafeFrame provides a consistent JS API to include 3rd party content
546 lines (322 loc) • 15.5 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content="JsDoc Toolkit" />
<title>$sf.lib.dom.msghost | SafeFrames JS API</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<meta name="mobileoptimized" content="0" />
<link rel="stylesheet" href="../css/all.css" media="all" />
<link rel="stylesheet" href="../css/handheld.css" media="only screen and (max-width: 660px)" />
<link rel="stylesheet" href="../css/handheld.css" media="handheld" />
<link rel="stylesheet" href="../css/screen.css" media="screen and (min-width: 661px)" />
<script src="../javascript/all.js"></script>
<!--[if lt IE 9]>
<script src="../javascript/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="index">
<div class="menu">
<div class="indexLinks">
</div>
<h2 class="heading1">Classes</h2>
<input type="text" name="classFilter" class="classFilter" id="ClassFilter" placeholder="Filter"></input>
<nav>
<ul class="classList" id="ClassList">
<li><a href="../symbols/%24sf.html">$sf</a></li>
<li><a href="../symbols/%24sf.env.html">$sf<span class='break'> </span>.<span class='break'> </span>env</a></li>
<li><a href="../symbols/%24sf.env.ua.html">$sf<span class='break'> </span>.<span class='break'> </span>env<span class='break'> </span>.<span class='break'> </span>ua</a></li>
<li><a href="../symbols/%24sf.lib.html">$sf<span class='break'> </span>.<span class='break'> </span>lib</a></li>
<li><a href="../symbols/%24sf.lib.dom.html">$sf<span class='break'> </span>.<span class='break'> </span>lib<span class='break'> </span>.<span class='break'> </span>dom</a></li>
<li><a href="../symbols/%24sf.lib.dom.iframes.html">$sf<span class='break'> </span>.<span class='break'> </span>lib<span class='break'> </span>.<span class='break'> </span>dom<span class='break'> </span>.<span class='break'> </span>iframes</a></li>
<li><a href="../symbols/%24sf.lib.dom.msghost.html">$sf<span class='break'> </span>.<span class='break'> </span>lib<span class='break'> </span>.<span class='break'> </span>dom<span class='break'> </span>.<span class='break'> </span>msghost</a></li>
<li><a href="../symbols/%24sf.lib.lang.html">$sf<span class='break'> </span>.<span class='break'> </span>lib<span class='break'> </span>.<span class='break'> </span>lang</a></li>
<li><a href="../symbols/%24sf.lib.lang.ParamHash.html">$sf<span class='break'> </span>.<span class='break'> </span>lib<span class='break'> </span>.<span class='break'> </span>lang<span class='break'> </span>.<span class='break'> </span>ParamHash</a></li>
<li><a href="../symbols/%24sf.pub.html">$sf<span class='break'> </span>.<span class='break'> </span>pub</a></li>
<li><a href="../symbols/%24sf.pub.Config.html">$sf<span class='break'> </span>.<span class='break'> </span>pub<span class='break'> </span>.<span class='break'> </span>Config</a></li>
<li><a href="../symbols/%24sf.pub.PosConfig.html">$sf<span class='break'> </span>.<span class='break'> </span>pub<span class='break'> </span>.<span class='break'> </span>PosConfig</a></li>
<li><a href="../symbols/%24sf.pub.Position.html">$sf<span class='break'> </span>.<span class='break'> </span>pub<span class='break'> </span>.<span class='break'> </span>Position</a></li>
<li><a href="../symbols/%24sf.vend.html">$sf<span class='break'> </span>.<span class='break'> </span>vend</a></li>
</ul>
</nav>
</div>
<div class="fineprint" style="clear:both">
<footer>
Documentation generator: <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0<br />
Template: <a href="" target="_blank">Codeview</a> 1.2.1<br />
Generated on:
<time datetime='2012-7-6' pubdate>2012-7-6 16:05</time>
</footer>
</div>
</div>
<div class="index indexStatic"></div>
<div class="content">
<div class="innerContent">
<article>
<header>
<h1 class="classTitle">
Namespace <span>$sf.lib.dom.msghost</span>
</h1>
<div class="intro">
<p class="description summary">
$sf.lib.dom.msghost Contains functionality to reside in the top level page for sending and receiving x-domain messages to SafeFrame containers
</p>
<ul class="summary">
</ul>
</div>
</header>
<!--
#### METHODS SUMMARY
-->
<section>
<div class="props">
<h2 class="sectionTitle">Method Summary</h2>
<nav>
<table class="summaryTable" id="MethodsList" cellspacing="0" summary="A summary of the methods documented in the class $sf.lib.dom.msghost.">
<thead>
<tr>
<th scope="col">Method Attributes</th>
<th scope="col">Method Name and Description</th>
</tr>
</thead>
<tbody>
<tr
class='item0'
>
<td class="attributes"><static> </td>
<td class="nameDescription">
<div class="fixedFont">$sf.lib.dom.msghost.<b><a href="../symbols/%24sf.lib.dom.msghost.html#.attach">attach</a></b>(el, pipe, cb)
</div>
<div class="description">Listen for messages from an IFRAME.</div>
</td>
</tr>
<tr
class='item1'
>
<td class="attributes"><static> </td>
<td class="nameDescription">
<div class="fixedFont">$sf.lib.dom.msghost.<b><a href="../symbols/%24sf.lib.dom.msghost.html#.detach">detach</a></b>(el)
</div>
<div class="description">Detach listening for messages from an IFRAME</div>
</td>
</tr>
<tr
class='item2'
>
<td class="attributes"><static> </td>
<td class="nameDescription">
<div class="fixedFont">$sf.lib.dom.msghost.<b><a href="../symbols/%24sf.lib.dom.msghost.html#.prep">prep</a></b>(attrs)
</div>
<div class="description">Prepare an iframe in the top level window to be able to send / receive cross-domain messages
Generally this method is called from $sf.lib.iframes.</div>
</td>
</tr>
<tr
class='item3'
>
<td class="attributes"><static> </td>
<td class="nameDescription">
<div class="fixedFont">$sf.lib.dom.msghost.<b><a href="../symbols/%24sf.lib.dom.msghost.html#.send">send</a></b>(tgtID, data)
</div>
<div class="description">Send a message to a child iframe.</div>
</td>
</tr>
<tr
class='item4'
>
<td class="attributes"><static> </td>
<td class="nameDescription">
<div class="fixedFont">$sf.lib.dom.msghost.<b><a href="../symbols/%24sf.lib.dom.msghost.html#.usingHTML5">usingHTML5</a></b>()
</div>
<div class="description">Get whether or not HTML5 style messaging can be used</div>
</td>
</tr>
</tbody>
</table>
</nav>
</div>
</section>
<!--
#### EVENTS SUMMARY
-->
<!--
#### CONSTRUCTOR DETAILS
-->
<!--
#### FIELD DETAILS
-->
<!--
#### METHOD DETAILS
-->
<section>
<div class="details props">
<div class="innerProps">
<h2 class="sectionTitle">
Method Detail
</h2>
<ul class="methodDetail" id="MethodDetail">
<li
class='item0'
>
<div class="fixedFont heading" id=".attach">
<span class='lighter'>
<static>
</span>
<span class="light">$sf.lib.dom.msghost.</span><b>attach</b>(el, pipe, cb)
</div>
<div class="description">
Listen for messages from an IFRAME. Note that on the host / publisher side
this library only allows for one message handler to be attached to a given
IFRAME.
</div>
<dl class="detailList params">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{HTMLElement}</span> <b>el</b>
</dt>
<dd>The IFRAME reference to attach a listener callback too. .</dd>
<dt>
<span class="light fixedFont">{Object}</span> <b>pipe</b>
</dt>
<dd>The message pipe object created from $sf.lib.dom.msghost.prep</dd>
<dt>
<span class="light fixedFont">{Function}</span> <b>cb</b>
</dt>
<dd>The callback function to fire when a message is received</dd>
</dl>
<div class="hr"></div>
</li>
<li
class='item1'
>
<div class="fixedFont heading" id=".detach">
<span class='lighter'>
<static>
</span>
<span class="light">$sf.lib.dom.msghost.</span><b>detach</b>(el)
</div>
<div class="description">
Detach listening for messages from an IFRAME
</div>
<dl class="detailList params">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{HTMLElement}</span> <b>el</b>
</dt>
<dd>The IFRAME reference to detach a listener</dd>
</dl>
<div class="hr"></div>
</li>
<li
class='item2'
>
<div class="fixedFont heading" id=".prep">
<span class='lighter'>
<static>
</span>
<span class="light">{Object}</span>
<span class="light">$sf.lib.dom.msghost.</span><b>prep</b>(attrs)
</div>
<div class="description">
Prepare an iframe in the top level window to be able to send / receive cross-domain messages
Generally this method is called from $sf.lib.iframes. The attrs object in question should
represent key/value pairs of HTML attributes for the iframe. Note that the attrs object passed
in will be modified with a new "name" property, to send information into the iframe and setup
messaging.
</div>
<dl class="detailList params">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{Object}</span> <b>attrs</b>
</dt>
<dd>Information required to set up the cross-domain messaging channel</dd>
<dt>
<span class="light fixedFont">{String}</span> <b>attrs.id</b>
</dt>
<dd>The IFRAME HTML id attribute</dd>
<dt>
<span class="light fixedFont">{String}</span> <b>attrs.src</b>
</dt>
<dd>The URL / src attribute of the IFRAME</dd>
<dt>
<span class="light fixedFont">{String}</span> <b>attrs.guid</b>
<i>Optional</i>
</dt>
<dd>The guid / signature to use to validate that messages sent/ received can be accepted. If not specified, one will be created automatically.</dd>
<dt>
<span class="light fixedFont">{String}</span> <b>attrs.name</b>
<i>Optional</i>
</dt>
<dd>The IFRAME HTML name attribute which will be used to send an intial message to the HTML document inside the IFRAME.</dd>
</dl>
<dl class="detailList nomargin">
<dt class="heading">Returns:</dt>
<dd><span class="light fixedFont">{Object}</span> An object with various properties detailing the messaging pipe-line.</dd>
</dl>
<div class="hr"></div>
</li>
<li
class='item3'
>
<div class="fixedFont heading" id=".send">
<span class='lighter'>
<static>
</span>
<span class="light">{Boolean}</span>
<span class="light">$sf.lib.dom.msghost.</span><b>send</b>(tgtID, data)
</div>
<div class="description">
Send a message to a child iframe.
</div>
<dl class="detailList params">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{String}</span> <b>tgtID</b>
</dt>
<dd>The HTML id attribute of the iframe element for which to send a message</dd>
<dt>
<span class="light fixedFont">{String}</span> <b>data</b>
</dt>
<dd>The string of data to send to the given iframe</dd>
</dl>
<dl class="detailList nomargin">
<dt class="heading">Returns:</dt>
<dd><span class="light fixedFont">{Boolean}</span> Whether or not message was send succesfully (note that this does not mean message was handled / recevied, only that sending was ok).</dd>
</dl>
<div class="hr"></div>
</li>
<li
class='item4'
>
<div class="fixedFont heading" id=".usingHTML5">
<span class='lighter'>
<static>
</span>
<span class="light">{Boolean}</span>
<span class="light">$sf.lib.dom.msghost.</span><b>usingHTML5</b>()
</div>
<div class="description">
Get whether or not HTML5 style messaging can be used
</div>
<dl class="detailList nomargin">
<dt class="heading">Returns:</dt>
<dd><span class="light fixedFont">{Boolean}</span> </dd>
</dl>
</li>
</ul>
</div>
</div>
</section>
<!--
#### EVENT DETAILS
-->
</article>
</div>
</div>
<script type="text/javascript">
wbos.CssTools.MediaQueryFallBack.LoadCss('../css/screen.css', '../css/handheld.css', 660)
codeview.classFilter.Init()
</script>
</body>
</html>