admin管理员组

文章数量:1123937

If I pass a function to Photopea is there a variable or object that they are assigned to?

For example, if I pass this example,

function sayHello() {
    alert("hello");
}

Is there an object like global or this that would now contain sayHello()? Even if it's a temporary object?

If I pass the string above I want to be able to access it with object notation like so:

function sayHello() {
    alert("hello");
}

function other() {
   this.sayHello();
   global.sayHello();
   globalThis.sayHello();
}

other();

none of the above work

Added test code. Visit Photopea and open the File > Script window.

function hello() { 
    alert("hello");
}
try {
    app.hello();
}catch(error) {}
try {
    this.hello();
}catch(error) {}
try {
    global.hello();
}catch(error) {}
try {
    globalThis.hello();
}catch(error) {}

本文标签: