Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
added message sending recieving API doc
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavul committed Mar 11, 2015
1 parent 69d898e commit 17bb3bd
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions javascripts/content_scripts/messagingJSON.md
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.

0 comments on commit 17bb3bd

Please sign in to comment.