(options)
| 7 | |
| 8 | export default class Schnack { |
| 9 | constructor(options) { |
| 10 | this.options = options; |
| 11 | this.options.endpoint = `${options.host}/comments/${options.slug}`; |
| 12 | this.initialized = false; |
| 13 | this.firstLoad = true; |
| 14 | |
| 15 | const url = new URL(options.host); |
| 16 | |
| 17 | if (url.hostname !== 'localhost') { |
| 18 | document.domain = url.hostname |
| 19 | .split('.') |
| 20 | .slice(1) |
| 21 | .join('.'); |
| 22 | } |
| 23 | |
| 24 | this.refresh(); |
| 25 | } |
| 26 | |
| 27 | refresh() { |
| 28 | const { target, slug, host, endpoint, partials } = this.options; |