MCPcopy Create free account
hub / github.com/ampproject/amphtml / getUpdateValue

Function getUpdateValue

extensions/amp-render/1.0/amp-render.js:32–43  ·  view source on GitHub ↗

* @param {string} bindingValue * @param {boolean} isFirstMutation * @return {boolean} Whether bind should evaluate and apply changes.

(bindingValue, isFirstMutation)

Source from the content-addressed store, hash-verified

30 * @return {boolean} Whether bind should evaluate and apply changes.
31 */
32function getUpdateValue(bindingValue, isFirstMutation) {
33 if (!bindingValue || bindingValue === Binding.REFRESH) {
34 // default is 'refresh', so check that its not the first mutation
35 return !isFirstMutation;
36 }
37 if (bindingValue === Binding.ALWAYS) {
38 // TODO(dmanek): add link to amp-render docs that elaborates on performance implications of "always"
39 user().warn(TAG, 'binding="always" has performance implications.');
40 return true;
41 }
42 return false;
43}
44
45/**
46 * Returns the non-empty node count in a template (defined as a `template`

Callers 1

Calls 2

userFunction · 0.90
warnMethod · 0.80

Tested by

no test coverage detected