Skip to content

Commit 4ba90a9

Browse files
committed
rename target attribute to output
1 parent 00b571d commit 4ba90a9

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

pyscriptjs/examples/repl2.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<body>
2323
<py-box widths="2/3;1/3">
24-
<py-repl id="my-repl" auto-generate="true" target="output"> </py-repl>
24+
<py-repl id="my-repl" auto-generate="true" output="output"> </py-repl>
2525
<div id="output"></div>
2626
</py-box>
2727
</body>

pyscriptjs/src/components/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export class BaseEvalElement extends HTMLElement {
132132
// @ts-ignore
133133
out.write.callKwargs(output, { append : true});
134134

135-
if (!this.hasAttribute('target')) {
135+
if (!this.hasAttribute('output')) {
136136
this.outputElement.hidden = false;
137137
}
138138
}

pyscriptjs/src/components/pyrepl.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class PyRepl extends BaseEvalElement {
134134

135135
currentComponentDetails.set([
136136
{key: "auto-generate", value: true},
137-
{key:"target", value: "default"},
137+
{key:"output", value: "default"},
138138
{key: "source", value: "self"},
139139
{key: "output-mode", value: "clear"}
140140
])
@@ -160,8 +160,8 @@ export class PyRepl extends BaseEvalElement {
160160
this.setAttribute("root", this.id);
161161
}
162162

163-
if (this.hasAttribute('target')) {
164-
this.outputElement = document.getElementById(this.getAttribute('target'));
163+
if (this.hasAttribute('output')) {
164+
this.outputElement = document.getElementById(this.getAttribute('output'));
165165

166166
// in this case, the default output-mode is append, if hasn't been specified
167167
if (!this.hasAttribute('output-mode')) {
@@ -174,7 +174,7 @@ export class PyRepl extends BaseEvalElement {
174174
this.outputElement.hidden = true;
175175
this.outputElement.id = this.id + "-" + this.getAttribute("exec-id");
176176

177-
// add the output div id there's not target
177+
// add the output div id if there's not output pre-defined
178178
mainDiv.appendChild(this.outputElement);
179179
}
180180

@@ -195,8 +195,8 @@ export class PyRepl extends BaseEvalElement {
195195
newPyRepl.setAttribute('root', this.getAttribute('root'));
196196
newPyRepl.id = this.getAttribute('root') + "-" + nextExecId.toString();
197197
newPyRepl.setAttribute('auto-generate', null);
198-
if (this.hasAttribute('target')){
199-
newPyRepl.setAttribute('target', this.getAttribute('target'));
198+
if (this.hasAttribute('output')){
199+
newPyRepl.setAttribute('output', this.getAttribute('output'));
200200
}
201201

202202
newPyRepl.setAttribute('exec-id', nextExecId.toString());

pyscriptjs/src/components/pyscript.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ type PyodideInterface = {
5656
class Script {
5757
source: string;
5858
state: string;
59-
target: string;
59+
output: string;
6060

61-
constructor(source: string, target: string) {
62-
this.target = target;
61+
constructor(source: string, output: string) {
62+
this.output = output;
6363
this.source = source;
6464
this.state = 'waiting';
6565
}
@@ -78,7 +78,7 @@ class Script {
7878
output = pyodide.runPython(this.source);
7979
}
8080

81-
if (this.target){
81+
if (this.output){
8282
// this.editorOut.innerHTML = s;
8383
}
8484
// if (output !== undefined){
@@ -161,7 +161,7 @@ export class PyScript extends BaseEvalElement {
161161

162162
currentComponentDetails.set([
163163
{key: "auto-generate", value: true},
164-
{key:"target", value: "default"},
164+
{key:"output", value: "default"},
165165
{key: "source", value: "self"}
166166
])
167167
}
@@ -172,15 +172,15 @@ export class PyScript extends BaseEvalElement {
172172

173173
mainDiv.appendChild(eDiv);
174174

175-
if (this.hasAttribute('target')) {
176-
this.outputElement = document.getElementById(this.getAttribute('target'));
175+
if (this.hasAttribute('output')) {
176+
this.outputElement = document.getElementById(this.getAttribute('output'));
177177
}else{
178178
// Editor Output Div
179179
this.outputElement = document.createElement('div');
180180
this.outputElement.classList.add("output");
181181
this.outputElement.hidden = true;
182182

183-
// add the output div id there's not target
183+
// add the output div id there's no output element
184184
mainDiv.appendChild(this.outputElement);
185185
}
186186

0 commit comments

Comments
 (0)