Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

Commit ecaae0a

Browse files
iterianicopybara-github
authored andcommitted
RELNOTES: Add a new flag that lets users change the stubbing behavior at runtime and another to always stub. The first flag is used in cr/511232461.
PiperOrigin-RevId: 511339596 Change-Id: I876d3a82f5db56522cd86f3fcb1d81acab947bf1
1 parent 96e0689 commit ecaae0a

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

closure/goog/soy/soy.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const safe = goog.require('goog.dom.safe');
2121
/**
2222
* A define to control the behavior of SoyJS. If set to true, all Soy templates
2323
* will check for the the presence of a stub template generated by Incremental
24-
* Dom, and delegate to it if present.. If it is set, then it delegates to the
24+
* Dom, and delegate to it if present. If it is set, then it delegates to the
2525
* function instead.
2626
*
2727
* This is a define because this adds a set amount of code per template to check
@@ -30,6 +30,30 @@ const safe = goog.require('goog.dom.safe');
3030
*/
3131
exports.shouldStub = goog.define('goog.soy.SHOULD_STUB', false);
3232

33+
/**
34+
* A define to always stub SoyJS with Incremental DOM templates.
35+
* @define {boolean}
36+
*/
37+
exports.alwaysStub = goog.define('goog.soy.ALWAYS_STUB', false);
38+
39+
let shouldStubAtRuntime = true;
40+
41+
/**
42+
* A runtime control for whether a Soy template will be replaced with an
43+
* Incremental DOM template. This is to allow teams to run a 3-arm experiment
44+
* with the default being NOOP (IDOM not not loaded), A1 (IDOM and SoyJS code
45+
* loaded), and A2 (A1 but code stubbed at runtime).
46+
* @return {boolean}
47+
*/
48+
exports.shouldStubAtRuntime = function() {
49+
return shouldStubAtRuntime;
50+
};
51+
52+
/** See above. */
53+
exports.disableStubbingAtRuntime = function() {
54+
shouldStubAtRuntime = false;
55+
};
56+
3357
/**
3458
* A structural interface for injected data.
3559
*

0 commit comments

Comments
 (0)