@akashic/akashic-sandbox
Version:
Standalone runner for Akashic contents
22 lines (21 loc) • 1.04 kB
JavaScript
// window 配下のObjectとなるため、命名規則のlintエラーを抑止
// eslint-disable-next-line @typescript-eslint/naming-convention
var MeddlingMath;
(function () {
MeddlingMath = new Proxy(Math, {
get: function (target, prop, _receiver) {
if (prop === "random") {
console.warn("Math.random()が実行されました。g.game.localRandom を使用してください。");
window.dispatchEvent(new ErrorEvent("akashicWarning", {
error: {
message: "Math.random()が実行されました。g.game.localRandom を使用してください。",
referenceUrl: "https://akashic-games.github.io/guide/sandbox-config.html#warn",
referenceMessage: "各種警告表示の設定や対応方法はこちらを参照してください。"
}
}));
}
return target[prop];
}
});
})();
window.MeddlingMath = MeddlingMath;