2020-07-19 13:49:44 -04:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
|
|
|
|
|
|
((window) => {
|
2020-09-16 16:22:43 -04:00
|
|
|
const core = window.Deno.core;
|
2020-07-19 13:49:44 -04:00
|
|
|
|
|
|
|
function resources() {
|
2020-09-16 16:22:43 -04:00
|
|
|
const res = core.jsonOpSync("op_resources");
|
2020-07-19 13:49:44 -04:00
|
|
|
const resources = {};
|
|
|
|
for (const resourceTuple of res) {
|
|
|
|
resources[resourceTuple[0]] = resourceTuple[1];
|
|
|
|
}
|
|
|
|
return resources;
|
|
|
|
}
|
|
|
|
|
|
|
|
function close(rid) {
|
2020-09-16 16:22:43 -04:00
|
|
|
core.jsonOpSync("op_close", { rid });
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
window.__bootstrap.resources = {
|
|
|
|
close,
|
|
|
|
resources,
|
|
|
|
};
|
|
|
|
})(this);
|