-
Notifications
You must be signed in to change notification settings - Fork 17
Executing Arbitrary JavaScript
Francisco Ryan Tolmasky I edited this page Oct 18, 2016
·
1 revision
Executes JavaScript in the given window
(or on the main page if window is null).
Attributes
- args - Arguments to pass the function that is run.
- window (optional) - The window in which to run the function.
- script - A function, whose last two parameters are resolve and reject, that will be run. Call resolve when completed, or reject with an error.
const execute = require("demokit/execute");
// Fade button in.
<execute window = "the-window"
script =
{
function(resolve, reject)
{
var button = document.getElementById("button");
var style = button.style;
button.addEventListener("transitionend", function end()
{
button.removeEventListener("transitionend");
resolve();
});
style.transition = "opacity 0.5s";
style.opacity = 1;
}
} />