Skip to content

Commit

Permalink
Prevent SSR Rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
parsagholipour committed Nov 28, 2022
1 parent 9d7679c commit c0888c4
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
16 changes: 8 additions & 8 deletions dist/Sharee.60987b84.js → dist/Sharee.1b963f5d.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const p = {
Facebook: x,
default: c
}, Symbol.toStringTag, { value: "Module" }));
class u {
class d {
constructor() {
n(this, "eventListeners", []);
}
Expand All @@ -48,7 +48,7 @@ const b = {
type: "column",
animation: "fade-down"
};
class d extends u {
class u extends d {
constructor(e) {
super();
n(this, "sharee");
Expand Down Expand Up @@ -167,7 +167,7 @@ function m(o, s) {
} while (o);
return !1;
}
class _ extends d {
class _ extends u {
constructor(s) {
super(s), this.options.type = "row";
}
Expand Down Expand Up @@ -244,7 +244,7 @@ class _ extends d {
const M = {
noTitle: !1
};
class H extends u {
class H extends d {
constructor(e) {
super();
n(this, "sharee");
Expand Down Expand Up @@ -320,7 +320,7 @@ const S = {
position: "top-right",
noTitle: !1
};
class O extends u {
class O extends d {
constructor(e) {
super();
n(this, "sharee");
Expand Down Expand Up @@ -390,7 +390,7 @@ class O extends u {
return i.innerHTML = e.getButtonText(), e.mainEl.appendChild(t), this.options.noTitle ? (e.mainEl.title = e.getButtonText(), e.mainEl.classList.add("sharee__no-title")) : e.mainEl.appendChild(i), e.mainEl.classList.add("sharee__driver__" + e.getName()), e.mainEl;
}
}
class z extends d {
class z extends u {
constructor(s) {
super(s), this.options.type = "row";
}
Expand Down Expand Up @@ -419,7 +419,7 @@ class z extends d {
}
}
const R = {
dropdown: d,
dropdown: u,
text: _,
normal: H,
fixed: O,
Expand Down Expand Up @@ -613,7 +613,7 @@ class h {
const t = R[this.options.mode];
if (typeof t > "u")
throw new Error('Selected mode "' + e.mode + '" not found');
this.strategy = new t(this), this.init().then(() => {
this.strategy = new t(this), typeof window < "u" && this.init().then(() => {
this.strategy.render();
});
}
Expand Down
2 changes: 1 addition & 1 deletion dist/sharee-react.js.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useRef as n, useEffect as u } from "react";
import { S as o } from "./Sharee.60987b84.js";
import { S as o } from "./Sharee.1b963f5d.js";
import { jsx as f } from "react/jsx-runtime";
import "lodash.merge";
function m(e) {
Expand Down
2 changes: 1 addition & 1 deletion dist/sharee-vue.js.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineComponent as a, ref as r, onMounted as s, onUnmounted as u, openBlock as p, createElementBlock as i } from "vue";
import { S as c } from "./Sharee.60987b84.js";
import { S as c } from "./Sharee.1b963f5d.js";
import "lodash.merge";
const _ = /* @__PURE__ */ a({
__name: "Sharee",
Expand Down
2 changes: 1 addition & 1 deletion dist/sharee.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { S as a } from "./Sharee.60987b84.js";
import { S as a } from "./Sharee.1b963f5d.js";
import "lodash.merge";
export {
a as default
Expand Down
6 changes: 3 additions & 3 deletions dist/sharee.min.js

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/lib/Sharee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ export default class Sharee {
throw new Error('Selected mode \"' + options.mode + '\" not found')
}
this.strategy = new strategyClass(this);
this.init().then(() => {
this.strategy.render()
});
if (typeof window !== 'undefined') {
this.init().then(() => {
this.strategy.render()
});
}
}

public static addDriver(driverName: string, driver: typeof Driver) {
Expand Down

0 comments on commit c0888c4

Please sign in to comment.