ember-window-messenger
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -5,4 +5,3 @@ import Ember from 'ember'; | ||
const { run } = Ember; | ||
const { aliasMethod } = Ember; | ||
const { run, aliasMethod } = Ember; | ||
@@ -9,0 +8,0 @@ export default Ember.Service.extend(BaseServiceMixin, { |
@@ -0,3 +1,8 @@ | ||
## v0.1.1 | ||
* Refactoring | ||
* Add unit tests for server: resolve, reject, query scenarios | ||
## v0.1.0 | ||
An initial release of this addon. |
{ | ||
"name": "ember-window-messenger", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Simple window postMessage Ember addon", | ||
@@ -14,3 +14,6 @@ "directories": { | ||
}, | ||
"repository": "", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/raido/ember-window-messenger" | ||
}, | ||
"engines": { | ||
@@ -44,3 +47,5 @@ "node": ">= 0.10.0" | ||
"keywords": [ | ||
"ember-addon" | ||
"ember-addon", | ||
"postMessage", | ||
"communication" | ||
], | ||
@@ -47,0 +52,0 @@ "dependencies": { |
@@ -9,3 +9,3 @@ # ember-window-messenger | ||
For changelog see [CHANGES.md](CHANGES.md) | ||
For changelog see [CHANGES.md](https://github.com/raido/ember-window-messenger/blob/master/CHANGES.md) | ||
@@ -18,5 +18,24 @@ **It supports JSON only messages for now** | ||
#### Configuration | ||
Add `target:origin` map to your `config/environment.js`. This effectively defines which targets (windows, frames) is your app communicating with. | ||
```javascript | ||
APP: { | ||
// Here you can pass flags/options to your application instance | ||
// when it is created | ||
'ember-window-messenger': { | ||
'parent': 'http://localhost:4200', | ||
'target-1': 'http://localhost:4200', | ||
'target-2': 'http://localhost:4200', | ||
'popup': 'http://localhost:4200' | ||
} | ||
} | ||
``` | ||
This list is also used for validation, to check if message comes from an allowed origin. | ||
### Examples | ||
If dare, fire up the dummy app in this addon and test it out. Below are the basic examples, see dummy app for more. | ||
If you dare, fire up the dummy app in this addon and test it out. Below are the basic examples, see dummy app for more. | ||
@@ -31,3 +50,5 @@ #### Setup server on parent | ||
beforeModel() { | ||
init() { | ||
this._super.apply(...arguments); | ||
server.on('demo-data' (resolve, reject, query) => { | ||
@@ -54,2 +75,18 @@ resolve('Some data'); | ||
#### Fetch from a specific target | ||
This can be used from parent window to frames/tabs communication. | ||
```javascript | ||
import Ember from 'ember'; | ||
export default Ember.Route.extend({ | ||
client: Ember.inject.service('window-messenger-client'), | ||
model() { | ||
return this.get('client').fetch('popup:demo-data'); | ||
} | ||
}); | ||
``` | ||
#### Execute RPC call | ||
@@ -56,0 +93,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
15752
129
0
253