MCPcopy Create free account
hub / github.com/bigskysoftware/_hyperscript / constructor

Method constructor

src/core/runtime/runtime.js:12–50  ·  view source on GitHub ↗
(owner, feature, hyperscriptTarget, event, runtime, globalScope, kernel, tokenizer)

Source from the content-addressed store, hash-verified

10
11export class Context {
12 constructor(owner, feature, hyperscriptTarget, event, runtime, globalScope, kernel, tokenizer) {
13 this.meta = {
14 parser: kernel,
15 tokenizer: tokenizer,
16 runtime,
17 owner: owner,
18 feature: feature,
19 iterators: {},
20 ctx: this
21 }
22 this.locals = {
23 cookies: cookies
24 };
25 if (typeof navigator !== "undefined" && navigator.clipboard) {
26 Object.defineProperty(this.locals, 'clipboard', {
27 get() { return navigator.clipboard.readText(); },
28 set(v) { navigator.clipboard.writeText(String(v)); },
29 enumerable: false,
30 configurable: true
31 });
32 }
33 if (typeof window !== "undefined" && window.getSelection) {
34 Object.defineProperty(this.locals, 'selection', {
35 get() { return window.getSelection().toString(); },
36 enumerable: true,
37 configurable: true
38 });
39 }
40 this.me = hyperscriptTarget;
41 this.you = undefined
42 this.result = undefined
43 this.beingTested = null
44 this.event = event;
45 this.target = event?.target ?? null;
46 this.detail = event?.detail ?? null;
47 this.sender = event?.detail?.sender ?? null;
48 this.body = "document" in globalScope ? document.body : null;
49 runtime.addFeatures(owner, this);
50 }
51}
52
53

Callers

nothing calls this directly

Calls 1

addFeaturesMethod · 0.45

Tested by

no test coverage detected