UNPKG

edo-htqw

Version:

A easier HTML element's dom operation libary.

22 lines (20 loc) 627 B
export default function (edo: { proto: (name: string, value: any) => boolean; [key: string]: any }) { edo.proto("text", function(val: string | undefined): string { if(val === undefined) { return this.el.innerText; } return this.el.innerText = val as string; }); edo.proto("html", function(val: string | undefined): string { if(val === undefined) { return this.el.innerHTML; } return this.el.innerHTML = val as string; }); edo.proto("href", function(val: string | undefined): string { if(val === undefined) { return this.el.href; } return this.el.href = val as string; }); }