NonceRuntimeModule.js 501 B

123456789101112131415161718192021222324
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Ivan Kopeykin @vankop
  4. */
  5. "use strict";
  6. const RuntimeGlobals = require("../RuntimeGlobals");
  7. const RuntimeModule = require("../RuntimeModule");
  8. class NonceRuntimeModule extends RuntimeModule {
  9. constructor() {
  10. super("nonce", RuntimeModule.STAGE_ATTACH);
  11. }
  12. /**
  13. * @returns {string | null} runtime code
  14. */
  15. generate() {
  16. return `${RuntimeGlobals.scriptNonce} = undefined;`;
  17. }
  18. }
  19. module.exports = NonceRuntimeModule;