cohere-js
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -5,12 +5,3 @@ const hookInputSetter = (target, key) => { | ||
set(value) { | ||
// IE11 - https://stackoverflow.com/a/49071358 | ||
let event; | ||
if (typeof Event === "function") { | ||
event = new Event("coherevalueupdate"); | ||
} | ||
else { | ||
event = document.createEvent("Event"); | ||
event.initEvent("coherevalueupdate", false, false); | ||
} | ||
this.dispatchEvent(event); | ||
this.dispatchEvent(new Event("coherevalueupdate")); | ||
if (orig && orig.set) { | ||
@@ -23,4 +14,4 @@ orig.set.call(this, value); | ||
const isSSR = typeof window === "undefined"; | ||
if (!isSSR) { | ||
const disableLoad = typeof window === "undefined" || window.document.documentMode; | ||
if (!disableLoad) { | ||
hookInputSetter(HTMLInputElement.prototype, "value"); | ||
@@ -42,4 +33,6 @@ hookInputSetter(HTMLInputElement.prototype, "checked"); | ||
// if script is not created | ||
let Cohere = isSSR ? noopModule : (window.Cohere = []); | ||
if (!isSSR) { | ||
let Cohere = disableLoad | ||
? noopModule | ||
: (window.Cohere = []); | ||
if (!disableLoad) { | ||
Cohere.invoked = true; | ||
@@ -46,0 +39,0 @@ Cohere.snippet = "0.4"; |
@@ -7,12 +7,3 @@ 'use strict'; | ||
set(value) { | ||
// IE11 - https://stackoverflow.com/a/49071358 | ||
let event; | ||
if (typeof Event === "function") { | ||
event = new Event("coherevalueupdate"); | ||
} | ||
else { | ||
event = document.createEvent("Event"); | ||
event.initEvent("coherevalueupdate", false, false); | ||
} | ||
this.dispatchEvent(event); | ||
this.dispatchEvent(new Event("coherevalueupdate")); | ||
if (orig && orig.set) { | ||
@@ -25,4 +16,4 @@ orig.set.call(this, value); | ||
const isSSR = typeof window === "undefined"; | ||
if (!isSSR) { | ||
const disableLoad = typeof window === "undefined" || window.document.documentMode; | ||
if (!disableLoad) { | ||
hookInputSetter(HTMLInputElement.prototype, "value"); | ||
@@ -44,4 +35,6 @@ hookInputSetter(HTMLInputElement.prototype, "checked"); | ||
// if script is not created | ||
let Cohere = isSSR ? noopModule : (window.Cohere = []); | ||
if (!isSSR) { | ||
let Cohere = disableLoad | ||
? noopModule | ||
: (window.Cohere = []); | ||
if (!disableLoad) { | ||
Cohere.invoked = true; | ||
@@ -48,0 +41,0 @@ Cohere.snippet = "0.4"; |
{ | ||
"name": "cohere-js", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "Cohere.so JS SDK", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
5302
128