Skip to content

Commit

Permalink
Makes Toggler SSR compatible #21
Browse files Browse the repository at this point in the history
  • Loading branch information
zenorocha committed Feb 16, 2018
1 parent 8b20417 commit f15921c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/metal-toggler/src/Toggler.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

import core from 'metal';
import {core, isServerSide} from 'metal';
import dom from 'metal-dom';
import {EventHandler} from 'metal-events';
import State from 'metal-state';
Expand All @@ -15,6 +15,10 @@ class Toggler extends State {
constructor(config) {
super(config);

if (isServerSide()) {
return;
}

this.headerEventHandler_ = new EventHandler();

this.on('headerChanged', this.syncHeader);
Expand All @@ -25,6 +29,10 @@ class Toggler extends State {
* @inheritDoc
*/
disposeInternal() {
if (isServerSide()) {
return;
}

super.disposeInternal();
this.headerEventHandler_.removeAllListeners();
}
Expand Down

0 comments on commit f15921c

Please sign in to comment.