Tag: JavaScript
All the articles with the tag "JavaScript".
JS 解决 'Failed to execute 'put' on 'IDBObjectStore'...' 问题
Published: at 06:00 PM本文介绍如何解决 JavaScript 中 IndexedDB 的 'Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned' 错误。该错误通常是因为存储对象包含不可序列化的数据类型(例如 Promise 对象)引起的。文章提供了几种解决方案,包括使用 `realistic-structured-clone` 库进行深拷贝,以及其他替代方案的比较。
JS MessageChannel 实现深拷贝
Published: at 05:21 PM使用 JavaScript 的 MessageChannel API 实现对象的深拷贝,并通过 Promise 处理异步操作,确保拷贝结果的正确性。
JavaScript structuredClone 深拷贝实现详解
Published: at 05:21 PM本文详细介绍了 JavaScript 中 `structuredClone` API 实现深拷贝的方法,并对比了使用 `MessageChannel` 实现异步深拷贝的技巧,以及相关的性能和应用场景。文章还提供了代码示例和参考链接,方便读者理解和实践。
Rollup 打包工具笔记
Published: at 10:44 AMRollup 是一个 JavaScript 模块打包器,可以将小块代码编译成大块复杂的代码,以便在浏览器中使用或在 Node.js 中使用。本文档包含 Rollup 的使用方法、示例以及与 Webpack 的对比。