-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
35 lines (27 loc) · 933 Bytes
/
test.js
File metadata and controls
35 lines (27 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import {define, html, property} from "./hybrids/index.js";
import * as ui from "./ui.js";
import * as element from "./createElement.js";
const defaults = {
createDescriptors,
base: {default: 0},
exp: {default: 0},
}; // defaults
const Test = element.create("test", defaults, initialize);
Test.render = ui.createRenderer(defaults);
define("audio-test", Test);
function initialize (host) {
console.debug("iniitialize...");
} // initialize
function createDescriptors (data) {
return Object.fromEntries(Object.entries(data).map(createDescriptor));
function createDescriptor (entry) {
const [name, data] = entry;
return {[name]: {
connect: (host, key) => host[key] = ui.processAttribute(host, key) || data[name].default,
observe: (host, value) => _set(host, name, value, data)
}}; // return
} // createDescriptor
} // createDescriptors
function _set (host, name, value, data) {
console.debug(`set ${name} to ${value}`);
} // _set