Skip to content

Commit

Permalink
Merge pull request #8 from franleplant/make-data-optional
Browse files Browse the repository at this point in the history
feature: make data in emitTo* methods be optional
  • Loading branch information
franleplant authored Dec 25, 2020
2 parents f1be11d + 200bdaa commit 8b13eb1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# [unreleased minor] 2020-12-23

### Changed

- the second argument `data` for `ichild.emitToParent` and `iparent.emitToChild` is optional now

2 changes: 1 addition & 1 deletion src/Child.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default class ChildAPI<TModel, TContext = any> extends Emittery {
}
}

emitToParent(eventName: string, data: unknown): void {
emitToParent(eventName: string, data?: unknown): void {
debug(`emitToParent "%s" with data %O`, eventName, data);

this.parent.postMessage(
Expand Down
2 changes: 1 addition & 1 deletion src/Parent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default class ParentAPI extends Emittery {
}
}

emitToChild(eventName: string, data: unknown): void {
emitToChild(eventName: string, data?: unknown): void {
debug(`emitToChild "%s" with data %O`, eventName, data);

this.child.postMessage(createParentEmit(eventName, data), this.childOrigin);
Expand Down

0 comments on commit 8b13eb1

Please sign in to comment.