Skip to content

Instantly share code, notes, and snippets.

View pavelfeldman's full-sized avatar

Pavel Feldman pavelfeldman

  • Microsoft
  • Sunnyvale, CA
View GitHub Profile
@pavelfeldman
pavelfeldman / clipboard.js
Created September 16, 2022 04:50
novnc_clipboard
export default class Clipboard {
constructor(target) {
this._target = target;
this._eventHandlers = {
'copy': this._handleCopy.bind(this),
'paste': this._handlePaste.bind(this)
};
// ===== EVENT HANDLERS =====
diff --git a/core/clipboard.js b/core/clipboard.js
new file mode 100644
index 0000000..a4a6813
--- /dev/null
+++ b/core/clipboard.js
@@ -0,0 +1,46 @@
+export default class Clipboard {
+ constructor(target) {
+ this._target = target;
+
<button id=submit>Submit</button>
<div id=log style='white-space: pre'></div>
<script>
const button = document.getElementById('submit');
button.addEventListener('mousedown', () => {
print('1. down');
Promise.resolve().then(() => print('2. down task ends'));
});
button.addEventListener('mouseup', () => {
print('3. up');