Warning: Use of undefined constant Symbol - assumed 'Symbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215 Warning: Use of undefined constant JavaScriptSymbol - assumed 'JavaScriptSymbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215

dojo/cache.js

  • Provides:

    • dojo.cache
  • dojo.cache

    • summary
      A getter and setter for storing the string content associated with the
      module and url arguments.
    • parameters:
      • module: (typeof String||Object)
        If a String, the module name to use for the base part of the URL, similar to module argument
        to <code>dojo.moduleUrl</code>. If an Object, something that has a .toString() method that
        generates a valid path for the cache item. For example, a dojo._Url object.
      • url: (typeof String)
        The rest of the path to append to the path derived from the module argument. If
        module is an object, then this second argument should be the &quot;value&quot; argument instead.
      • value: (typeof String||Object)
        If a String, the value to use in the cache for the module/url combination.
        If an Object, it can have two properties: value and sanitize. The value property
        should be the value to use in the cache, and sanitize can be set to true or false,
        to indicate if XML declarations should be removed from the value and if the HTML
        inside a body tag in the value should be extracted as the real value. The value argument
        or the value property on the value argument are usually only used by the build system
        as it inlines cache content.
    • returns
      String
    • description
      module and url are used to call `dojo.moduleUrl()` to generate a module URL.
      If value is specified, the cache value for the moduleUrl will be set to
      that value. Otherwise, dojo.cache will fetch the moduleUrl and store it
      in its internal cache and return that cached value for the URL. To clear
      a cache value pass null for value. Since XMLHttpRequest (XHR) is used to fetch the
      the URL contents, only modules on the same domain of the page can use this capability.
      The build system can inline the cache values though, to allow for xdomain hosting.
    • example
      To ask dojo.cache to fetch content and store it in the cache (the dojo["cache"] style
      of call is used to avoid an issue with the build system erroneously trying to intern
      this example. To get the build system to intern your dojo.cache calls, use the
      "dojo.cache" style of call):
      	//If template.html contains "<h1>Hello</h1>" that will be
      	//the value for the text variable.
      	var text = dojo["cache"]("my.module", "template.html");
    • example
      To ask dojo.cache to fetch content and store it in the cache, and sanitize the input
      (the dojo["cache"] style of call is used to avoid an issue with the build system
      erroneously trying to intern this example. To get the build system to intern your
      dojo.cache calls, use the "dojo.cache" style of call):
      	//If template.html contains "<html><body><h1>Hello</h1></body></html>", the
      	//text variable will contain just "<h1>Hello</h1>".
      	var text = dojo["cache"]("my.module", "template.html", {sanitize: true});
    • example
      Same example as previous, but demostrates how an object can be passed in as
      the first argument, then the value argument can then be the second argument.
      	//If template.html contains "<html><body><h1>Hello</h1></body></html>", the
      	//text variable will contain just "<h1>Hello</h1>".
      	var text = dojo["cache"](new dojo._Url("my/module/template.html"), {sanitize: true});
    • type
      Function
  • cache

    • type
      Object
  • dojo.cache._sanitize

    • parameters:
      • val: (typeof String)
    • returns
      String
    • summary
      Strips &lt;?xml ...?&gt; declarations so that external SVG and XML
      documents can be added to a document without worry. Also, if the string
      is an HTML document, only the part inside the body tag is returned.
    • description
      Copied from dijit._Templated._sanitizeTemplateString.
    • type
      Function
  • dojo

    • type
      Object