This repository has been archived by the owner on Dec 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added message sending recieving API doc
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Sending and Recieving Messages API | ||
======================================= | ||
|
||
Any injected application can send messages to the content script (privly.js) to trigger it to resize, show or hide the iframe content. JSON is used for this communication. Injected application can use the following blueprint for sending messages :- | ||
|
||
An example of a message could be: | ||
``` | ||
{command:"resize", | ||
frameID:"name of iframe" | ||
heightNEW:No. of pixels, | ||
} | ||
``` | ||
|
||
**A possible syntax for sending this message over the host would be:** | ||
```javascript | ||
var message = {command:"resize", | ||
frameID:"name of iframe" | ||
heightNEW:No. of pixels | ||
}; | ||
msgJSON = JSON.stringify(message); | ||
parent.postMessage(JSON.stringify(resizeData),"*"); | ||
``` | ||
|
||
##Possible set of options | ||
|
||
* command : "resize" | "hide" | "show" | ||
* frameID : "<name of iframe>" | ||
* heightNEW : no. of pixels | ||
|
||
|
||
While using `hide` or `show` as the command, `heightNEW` doesn't matter and you may or may not include it in your message. | ||