Skip to content

Commit

Permalink
fix event listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
mageowl committed Dec 24, 2020
1 parent c4c7fac commit 9bd8c63
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/defaultModules/math.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ scope.localFunctions.set("sin", {
type: "js",
run(number) {
if (number.type != "NumberLiteral") {
error(`I need a number to get the sin. I got a ${number.type}.`, "Type");
error(`I need a number to get the sine. I got a ${number.type}.`, "Type");
}

return { type: "NumberLiteral", value: Math.sin(number.value) };
Expand All @@ -32,7 +32,7 @@ scope.localFunctions.set("cos", {
run(number) {
if (number.type != "NumberLiteral") {
error(
`I need a number to get the cosin. I got a ${number.type}.`,
`I need a number to get the cosine. I got a ${number.type}.`,
"Type"
);
}
Expand Down Expand Up @@ -60,7 +60,7 @@ scope.localFunctions.set("atan", {
run(number) {
if (number.type != "NumberLiteral") {
error(
`I need a number to get the a-tangent. I got a ${number.type}.`,
`I need a number to get the arc tangent. I got a ${number.type}.`,
"Type"
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/defaultModules/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class HTMLElementScope extends Scope {
run(event, data, yieldFunction) {
if (self.destroyed)
error("Tring to access a destroyed element.", "Web");
el.addEventListener(event, () => {
el.addEventListener(event.value, () => {
execute(yieldFunction, data);
});
}
Expand Down
15 changes: 2 additions & 13 deletions test/helloWorld.func
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!web>
web.useElementAsConsole("fscript-logs");

** def(<lessThan>) -> {
def(<lessThan>) -> {
<!math>
def(<diff>) -> sub(param(0), param(1));
def(<less>) -> false;
Expand All @@ -25,15 +25,4 @@ def(mem) -> "Wow!";
};

func;
print(value); **

obj(<xyz>) -> {
def(<a>) -> ;
def(<b>) -> {
print(a);
set(<a>) -> "10";
print(a);
};
}

xyz.b;
print(value);

0 comments on commit 9bd8c63

Please sign in to comment.