cohere-js
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -5,3 +5,12 @@ const hookInputSetter = (target, key) => { | ||
set(value) { | ||
this.dispatchEvent(new Event("coherevalueupdate")); | ||
// 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); | ||
if (orig && orig.set) { | ||
@@ -20,2 +29,3 @@ orig.set.call(this, value); | ||
hookInputSetter(HTMLSelectElement.prototype, "value"); | ||
hookInputSetter(HTMLSelectElement.prototype, "selectedIndex"); | ||
} | ||
@@ -54,5 +64,2 @@ const bridgedMethods = ["init", "identify", "stop", "showCode"]; | ||
} | ||
else { | ||
document.head.insertBefore(script, document.head.firstChild); | ||
} | ||
} | ||
@@ -59,0 +66,0 @@ const exportedModule = Cohere; |
@@ -7,3 +7,12 @@ 'use strict'; | ||
set(value) { | ||
this.dispatchEvent(new Event("coherevalueupdate")); | ||
// 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); | ||
if (orig && orig.set) { | ||
@@ -22,2 +31,3 @@ orig.set.call(this, value); | ||
hookInputSetter(HTMLSelectElement.prototype, "value"); | ||
hookInputSetter(HTMLSelectElement.prototype, "selectedIndex"); | ||
} | ||
@@ -56,5 +66,2 @@ const bridgedMethods = ["init", "identify", "stop", "showCode"]; | ||
} | ||
else { | ||
document.head.insertBefore(script, document.head.firstChild); | ||
} | ||
} | ||
@@ -61,0 +68,0 @@ const exportedModule = Cohere; |
{ | ||
"name": "cohere-js", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Cohere.so JS SDK", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
5834
142