Indexeddb 简明教程
IndexedDB - ECMAScript Binding
Firstly, what is ECMAScript?
ECMAScript(欧洲计算机制造商协会脚本)是一种基于 JavaScript 的脚本语言。
ECMAScript (European Computer Manufacturers Association Script) is a scripting language based on JavaScript.
JavaScript ES6 添加了新的语法和功能,以便更容易读取代码,并且我们可以为相同的功能编写更少的代码。ES6 有许多新功能,例如箭头函数、模板字符串、类分解等。
JavaScript ES6 adds new syntaxes and features so that the code is more easily readable and we can write less code for the same functionality. ES6 has many new features like arrow functions, template strings, class destruction, etc.
绑定 - 使用“this”关键字将对象绑定到函数并引用它。
Binding - Bind an object to a function and reference it using the ‘this’ keyword.
ECMAScript 处理键、值和键路径。
ECMAScript deals with keys, values, and keypaths.
它定义了此规范中定义的键值如何转换为 ECMAScript 值以及如何从 ECMAScript 值转换。
It defines how key values defined in this specification are converted to and from ECMAScript values.
Extract a key from a value
若要使用包含值、键路径和可选的多条目标志的键路径从值中提取键,我们需要执行以下步骤。结果可以是键、无效、失败,甚至异常。
To extract a key from a value using a key path with value, keyPath, and an optional multi-entry flag we need to follow the following steps. The results can be a key, invalid, failure, or even an exception.
-
Where r is the result of evaluating a keypath on a value with value and keypath. Rethrow any exceptions. If r is a failure return failure.
-
key be the result of converting a value to a key with r if the multi-entry flag is false, and the result of converting a value to a multi-entry key with r otherwise. Rethrow any exceptions.
-
If the key is invalid, return invalid.
-
Return key.