Reading Samples and Test-Cases
Guide on how to read problem package samples and custom user test-cases.
Use monkeyCodeInput package
To easily read input samples and user tests, import monkeyCodeInput.js in your entry index.html file
Include
monkeyCodeInput.js at the top of the <head> in your index.html file, before any plugin or application scripts. Otherwise, the page and your plugin code may load before the script is available on first load.Use a relative path (for example,
./monkeyCodeInput.js) for the script source so it works reliably in different environments.<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Inject package -->
<script src="monkeyCodeInput.js"></script>
</head>
<body>
...
</body>
</html>
Reading Input without monkeyCodeInput package
Inside your index.html, read the input from the URL hash:
const raw = decodeURIComponent(window.location.hash.replace('#input=', ''))
// `raw` now contains the current sample input as a plain string
Since the iframe is re-created whenever the selected sample input changes, your plugin will always receive fresh input on load.