'outer'这个散文代码是什么意思?



此处https://github.com/ProseMirror/prosemirror-state/blob/master/src/state.js#L122是prosecmirror js代码行:

applyTransaction(rootTr) {
//...
outer: for (;;) {

在这个javascript代码中,无限循环之前的"外部"是什么意思?

上升

功能的完整代码:

applyTransaction(rootTr) {
if (!this.filterTransaction(rootTr)) return {state: this, transactions: []}
let trs = [rootTr], newState = this.applyInner(rootTr), seen = null
// This loop repeatedly gives plugins a chance to respond to
// transactions as new transactions are added, making sure to only
// pass the transactions the plugin did not see before.
outer: for (;;) { // <--- this line !!!
let haveNew = false
for (let i = 0; i < this.config.plugins.length; i++) {
let plugin = this.config.plugins[i]
if (plugin.spec.appendTransaction) {
let n = seen ? seen[i].n : 0, oldState = seen ? seen[i].state : this
let tr = n < trs.length &&
plugin.spec.appendTransaction.call(plugin, n ? trs.slice(n) : trs, oldState, newState)
if (tr && newState.filterTransaction(tr, i)) {
tr.setMeta("appendedTransaction", rootTr)
if (!seen) {
seen = []
for (let j = 0; j < this.config.plugins.length; j++)
seen.push(j < i ? {state: newState, n: trs.length} : {state: this, n: 0})
}
trs.push(tr)
newState = newState.applyInner(tr)
haveNew = true
}
if (seen) seen[i] = {state: newState, n: trs.length}
}
}
if (!haveNew) return {state: newState, transactions: trs}
}
}

这是一个标签。

带标签的语句可以与break或continue语句一起使用。它是在语句前面加上一个标识符,你可以参考这个标识符

浏览链接的源代码,我的第一个猜测是它在那里,所以插件可以引用它。

相关内容

  • 没有找到相关文章

最新更新