async Register Tags example

This commit is contained in:
ssendev
2019-03-21 20:46:21 +08:00
committed by Jun Yang
parent 265534b7b7
commit b7b92c63cf
+3 -5
View File
@@ -226,11 +226,9 @@ engine.registerTag('upper', {
parse: function(tagToken, remainTokens) { parse: function(tagToken, remainTokens) {
this.str = tagToken.args; // name this.str = tagToken.args; // name
}, },
render: function(scope, hash) { render: async function(scope, hash) {
var str = Liquid.evalValue(this.str, scope); // 'alice' var str = await Liquid.evalValue(this.str, scope); // 'alice'
return str.then(function(name) { return str.toUpperCase() // 'Alice'
return name.toUpperCase() // 'Alice'
})
} }
}); });
``` ```