👔TouchList+ext
🚧 under construction -> Object+ArrayLike
browser ⟩ event ⟩ type ⟩ touch ⟩ TouchList extension
extend TouchList with custom methods.
replit ⟩ tap screen , require ⟩ Object+arrayLike
// 2023.01.17 - 08:24 (+) Object + array-like
// 2023.01.16 - 22:44 (•) first draft
// -------------------------------------------------------
import { } from './Object+ArrayLike.js'; // 👔 Object + array-like
// ⭐ TouchList extension
// ------------------------
// 🔹 .toString()
//
Object.defineProperties(TouchList.prototype, {
// 🔹 .toString()
toString: {
value: function() {
return '[' + this
// 👔 Object + array-like
.map(({pageX: x, pageY: y}) => `(${x}, ${y})`)
.join(', ') + ']';
},
}
});
// ⭐ export
export {}; // ES module
History
// 2023.01.16 - 22:44 - first version
// -------------------------------------------------------
// ⭐ TouchList extension
// ------------------------
// 🔹 .toString()
//
Object.defineProperties(TouchList.prototype, {
// 🔹 .toString()
toString: {
value: function() {
let points = [];
for(let i = 0; i < this.length; i++) {
const {pageX: x, pageY: y} = this.item(i);
points.push(`(${x}, ${y})`);
}
return `[${points.join(', ')}]`;
},
}
});
// ⭐ export
export {}; // ES module
Last updated
Was this helpful?