1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-13 18:21:51 +00:00
tobspr_shapez.io/mod_examples/pasting.js

24 lines
648 B
JavaScript
Raw Normal View History

2022-01-17 11:15:57 +00:00
// @ts-nocheck
2022-01-17 08:34:34 +00:00
const METADATA = {
website: "https://tobspr.io",
author: "tobspr",
name: "Mod Example: Pasting",
version: "1",
id: "pasting",
description: "Shows how to properly receive paste events ingame",
2022-01-22 08:03:42 +00:00
minimumGameVersion: "^1.5.0",
2022-01-17 08:34:34 +00:00
};
class Mod extends shapez.Mod {
init() {
this.signals.gameInitialized.add(root => {
root.gameState.inputReciever.paste.add(event => {
event.preventDefault();
const data = event.clipboardData.getData("text");
this.dialogs.showInfo("Pasted", "You pasted: '" + data + "'");
});
});
}
}