This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
customElements.define( | |
"vwo-marquee", | |
class extends HTMLElement { | |
static observedAttributes = ["eyebrow", "title", "description"]; | |
constructor() { | |
super(); | |
this.attachShadow({ mode: "open" }); | |
this.shadowRoot.innerHTML = this.layout; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isObject = value => typeof value === "object" && value !== null; | |
// #region recursive | |
const getR = (obj, path, defaultValue) => { | |
const pathParts = path.split("."); | |
if (!isObject(obj) && !Array.isArray(obj)) return defaultValue; | |
if (typeof path !== "string" || path.length <= 0 || !Object.hasOwn(obj, pathParts[0])) { | |
return defaultValue; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fromNullable(value) { | |
return value === undefined || value === null ? Nothing() : Just(value); | |
} | |
function Nothing() { | |
return { | |
map: Nothing, | |
chain: Nothing, | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IObserver<T> { | |
(value: T): void; | |
} | |
class Observable<T> { | |
#value: T; | |
#observers: Set<IObserver<T>>; | |
static of<T>(initialValue: T) { | |
return new Observable(initialValue); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface TNode<T> { | |
value: T; | |
children: TNode<T>[]; | |
} | |
class Node_<T> { | |
#value: T; | |
#children: Node_<T>[] = []; | |
static fromObject<T>(template_object: TNode<T>) { |