Scroll the document when scrollTop message is sent from viewer#6679
Scroll the document when scrollTop message is sent from viewer#6679muxin merged 2 commits intoampproject:masterfrom
Conversation
966919d to
8bfd935
Compare
5ab1d96 to
57d94cb
Compare
| this.broadcastObservable_ = new Observable(); | ||
|
|
||
| /** @private {!Observable<!JSONType>} */ | ||
| this.scrollDocObservable_ = new Observable(); |
There was a problem hiding this comment.
Does it make sense to introduce more API dependencies when we are in the process of moving them out? Let's just create a generic observable for all types of messages?
There was a problem hiding this comment.
What do you mean? Is there a PR where we are moving out the API dependencies? Do you mean changing this to the following?
/** @private {!Observable} */
this.scrollDocObservable_ = new Observable();
There was a problem hiding this comment.
There'd be a map of observables: !Object<string, !Observable<!JSONType>>. The index is the type of message. The API will be viewer.onMessage(eventType, handler). The records in the map will be created from calls to this API. Thus we simply remove a switch if (eventType == 'x') {x.fire(payload);} to simply if (observables[eventType]) {observables[eventType].fire(payload)}.
57d94cb to
a6078a4
Compare
a7bfa7a to
b164d49
Compare
b164d49 to
b9298b8
Compare
|
Rebased after refactoring observables in |
Fix #6588