From bb065d7dfaf35f992eef4d02b58917ca8f46b36d Mon Sep 17 00:00:00 2001
From: Anton Vayvod
castBtn.style.display = evt.available ? "inline" : "none";
};
</script>
-
+
<script>
// it is also possible to use relative presentation URL e.g. "presentation.html"
var presUrl = "http://example.com/presentation.html";
- // create random presId
+ // create random presId
var presId = Math.random().toFixed(6).substr(2);
// Start new session. presId is optional.
navigator.presentation.startSession(presUrl, presId)
@@ -585,7 +585,7 @@
<!-- controller.html -->
<script>
- // read presId from localStorage if exists
+ // read presId from localStorage if exists
var presId = localStorage && localStorage["presId"] || null;
// presId is mandatory for joinSession.
presId && navigator.presentation.joinSession(presUrl, presId)
@@ -622,7 +622,7 @@
@@ -718,7 +718,7 @@
console.log("receive message",msg);
};
// send message to presentation page
- session.postMessage("say hello");
+ session.send("say hello");
}
};
var endSession = function () {
@@ -643,7 +643,7 @@
};
session.onmessage = function (msg) {
if (msg == "say hello")
- session.postMessage("hello");
+ session.send("hello");
};
</script>
session.onstatechange = function() {
switch (session.state) {
case 'connected':
- session.postMessage(/*...*/);
+ session.send(/*...*/);
session.onmessage = function() { /*...*/ };
break;
case 'disconnected':
@@ -798,7 +798,7 @@
and state handling. Initially, the state of the
PresentationSession
is "connected"
. At this
point, the opening browsing context can communicate with
- the presentation page using the session's postMessage()
+ the presentation page using the session's send()
to send messages and its onmessage
event handler to
receive messages. The presentation page will also have access to
PresentationSession
that it can use to send and receive
@@ -909,7 +909,7 @@
if (navigator.presentation.session) {
var session = navigator.presentation.session;
// Communicate with opening browsing context
- session.postMessage(/*...*/);
+ session.send(/*...*/);
session.onmessage = function() {/*...*/};
session.onstatechange = function() {
@@ -928,7 +928,7 @@
session. This session is a similar object as in the first example.
Here, its initial state is
"connected"
, which means we
can use it to communicate with the opening browsing
- context using postMessage()
and
+ context using send()
and
onmessage
.
@@ -1040,15 +1040,13 @@
- When the postMessage()
method is called on
- a PresentationSession
object with a
- message
, the user agent must run the algorithm to
- post a message through a
+ When the send()
method is called on a
+ PresentationSession
object with a message
,
+ the user agent must run the algorithm to send a message through a
PresentationSession
.
@@ -1083,17 +1081,17 @@
ISSUE - 46: Define postMessage behavior + 46: Define send behavior
PresentationSession
+ Sending a message through PresentationSession
Presentation API does not mandate a specific protocol for the
connection between the opening browsing context and
the presenting browsing context except that for
- multiple calls to postMessage
it has to be ensured
- that messages are delivered to the other end in sequence.
+ multiple calls to send
it has to be ensured that
+ messages are delivered to the other end in sequence.
Let presentation message data be the payload data to be @@ -1102,9 +1100,9 @@
text
and binary
.
- When the user agent is to post
- a message through a PresentationSession
S, it
- must run the following steps:
+ When the user agent is to send a
+ message through a PresentationSession
S, it must
+ run the following steps:
state
property of
@@ -1120,14 +1118,12 @@ PresentationSession
PresentationSession
+ PresentationSession
PresentationSession
@@ -630,7 +630,7 @@ <!-- controller.html --> <script> - // read presId from localStorage if exists + // read presId from localStorage if exists var presId = localStorage && localStorage["presId"] || null; // presId is mandatory for joinSession. presId && navigator.presentation.joinSession(presUrl, presId) @@ -694,7 +694,7 @@@@ -789,7 +789,7 @@5 console.log("receive message",msg); }; // send message to presentation page - session.postMessage("say hello"); + session.send("say hello"); } }; var endSession = function () { @@ -714,7 +714,7 @@
5 }; session.onmessage = function (msg) { if (msg == "say hello") - session.postMessage("hello"); + session.send("hello"); }; </script>
PresentationSession
is "connected"
. At this
point, the opening browsing context can communicate with
- the presentation page using the session's postMessage()
+ the presentation page using the session's send()
to send messages and its onmessage
event handler to
receive messages. The presentation page will also have access to
PresentationSession
that it can use to send and receive
@@ -980,7 +980,7 @@ "connected"
, which means we
can use it to communicate with the opening browsing
- context using postMessage()
and
+ contextsend()
and
onmessage
.
@@ -1106,10 +1106,10 @@
- When the postMessage()
method is called on
- a PresentationSession
object with a
- message
, the user agent must run the algorithm to
- post a message through a
+ When the send()
method is called on a
+ PresentationSession
object with a message
,
+ the user agent must run the algorithm to send a message through a
PresentationSession
.
@@ -1143,17 +1142,17 @@
ISSUE - 46: Define postMessage behavior + 46: Define send behavior
PresentationSession
+ PresentationSession
Presentation API does not mandate a specific protocol for the
connection between the opening browsing context and
the presenting browsing context except that for
- multiple calls to postMessage
it has to be ensured
- that messages are delivered to the other end in sequence.
+ multiple calls to send
it has to be ensured that
+ messages are delivered to the other end in sequence.
Let presentation message data be the payload data to be @@ -1162,9 +1161,9 @@
text
and binary
.
- When the user agent is to post
- a message through a PresentationSession
S, it
- must run the following steps:
+ When the user agent is to send a
+ message through a PresentationSession
S, it must
+ run the following steps:
state
property of
@@ -1180,14 +1179,12 @@