Files
WebODF/programs/editor/plugins/bella/SimpleStatusReporter.js
T
Philip Peitsch 5e26b5a1e0 Meet Bella. She will destroy your documents.
* Supports multiple instances in the same doc
* Able to exercise entire selection controller
* Can say meow (and other text manipulation actions)
* Knows  about undo & redo
* Will also destroy your document formatting too!
* Can cut, copy & paste
* Bella is a tidy cat and likes valid documents
* Bella can be hooked up to use an existing cursor
* Custom actions to be loaded externally
* Has AMD integration
* Add checks to ensure the cursor is in a valid step.
Issue highlighted in review of PR #451.
* Add a seeded random number generator to allow reproduction of crashes.
Original source: https://github.com/davidbau/seedrandom
* Add some really simple reporting stats
* Allow seed to be specified via URL

Major features
==============
Add an "auto drive" feature (the cat herder)

Auto drive will automatically cycle the page after the specified
number of pounces. If an unhandled exception occurs, it will PUT a
file to the server in the same location that contains the number of
pounces that happened, and the original seed, along with the error
information.

Notes
=====
* Limit how frequently document length checks are performed
* Using a real SessionController causes problems with double-events
2015-06-07 13:16:33 +02:00

35 lines
1.1 KiB
JavaScript

define("webodf/plugins/bella/SimpleStatusReporter", function() {
"use strict";
var webodf = window; // WebODF doesn't support AMD yet...
function SimpleStatusReporter(bellaInstance) {
var container, updateIntervalId;
function updateState() {
var state = bellaInstance.getState();
container.textContent = JSON.stringify(state, null, "\t");
}
this.destroy = function () {
window.clearInterval(updateIntervalId);
if (container) {
container.parentNode.removeChild(container);
container = null;
}
};
function init() {
var doc = webodf.runtime.getWindow().document;
container = doc.createElement("pre");
container.style.position = "fixed";
container.style.bottom = "0";
container.style.right = "0";
doc.body.appendChild(container);
updateIntervalId = window.setInterval(updateState, 100);
}
init();
}
return SimpleStatusReporter;
});