Menu Developer Moovweb University

SDK v6.1 - April 29, 2015

Bug fixes:

  • Image assets passed through the server should no longer be garbled
  • Content-Length header of a perfect proxied response did not match the length of the request, causing errors
  • console.log statements executed before an Exception occurs will now properly output to the terminal as intended
  • Fixed duplicated error messages for command line flag errors
  • Removed command line flag help messages from errors irrelevant to flags.
  • moov_stdlib - fns.Assets() should now properly resolve paths with extra trailing slashes

Control Center:

  • Visual Improvements to distinguish between Javascript and Tritium projects
  • Added Modes Admin section to the project settings page for switching modes to use JavaScript or Tritium
  • Brew support for the moov SDK has been deprecated!
  • Various language improvements for error messages

Generator (Guap):

  • The generator template has been updated to serve the latest moovweb modules
  • Package.json contains all the latest modules
  • .gitignore has been updated to no longer ignore main.js and ignore moov_main.js instead

Moovweb NPM Modules:

  • New! moov_cache - Equivalent functionality to the tritium cache mixer

    • cache.enable_for(seconds); Adds the caching header for the page for the specified period of time.
    • cache.force(); Adds a forced caching header to the page. This function will set the cache control header to a non-zero TTL. The cache headers will be set regardless of the upstream response’s cache headers (even if its set to max-age 0 for example).
    • cache.force(); cache.force_for(seconds) Forces caching of things for a specified period of time in Moovweb’s cache only. This function will set the necessary headers to tell Moovweb to cache the current response and strip other caching headers out. The parameter is the number of seconds to cache things for.
    • cache.html(tag,enc) The html function sets up the page so that content you label as “dynamic” is fetched as needed, while static sections of the page to be cached. This will set up the page so that all chosen tag parts(e.g. div) with the “dynamic” attribute are stripped out and will be loaded later. If it is a fragment/dynamic hit, content in the cachebox will be stored into a JSON array and get returned. Unlike tritium html scope, enc argument will not change the encoding but just export “Content-Type-Charset” to be the enc. If enc is undefined, the encoding flag will set “utf-8” as default.
  • moov_stdlib v2.4.50

    • New function! fns.perfectProxy(); Rewrites links and src attributes of the current global html object. Example usage:
          // index.js
          init$(body);
          …
          require("./mappings.js");

          # mappings.js
          …
          if (/* matches some page we want to rewrite */) {
              // require the file for this page
          else if ( /* logic for this-should-be-perfect-proxied */) {
              fns.perfectProxy();
          } else {
              // if you don’t match at all, perfect proxy
              fns.perfectProxy();
          }
          return $.html();
 Note: some non-html content types (such as ajax requests passed through the server) require perfectProxy() to avoid CORS-related errors from rejecting the request.
  • Ported functions:
    • PERF mixer Functions now available in moov_stdlib:
      • fns.insertDnsPrefetch(); adds a dns-prefetch attribute to elements that load assets
      • fns.insertSubresource('http://placekitten.com/100/200'); adds a subresource link for elements to hint the browser to load assets that will be needed for this particular page or view.
      • fns.moveStylesToHead(); finds any CSS elements inside the body element and moves them to the head
      • fns.moveStylesAboveScripts(); finds any CSS elements and moves them above the first script element
    • Assert Mixer Function in moov_stdlib:
      • fns.assert(1 > 0); will error if condition is not met (only throws errors locally, not in cloud/production traffic) e.g.: fns.assert($("#important").length > 0);
    • Layers Mixer functions in moov_stdlib:
      • fns.activeLayers(); returns a list of the active layers.
      • fns.queryLayerText('mobile'); returns ‘1’ if the specified layer is active otherwise ‘0’
      • fns.layer('mobile'); returns true if the specified layer is active otherwise false
      • fns.layerNot('tablet'); returns true if the specified layer is not active otherwise false
  • moov_bundler v2.1.12
    • Output file renamed from main.js to moov_main.js
    • Recursive file-watching support added for Linux and Windows
    • npm run bundle now rewrites moov_main.js only after finishing bundling
    • Requests to moov server received during bundling process will render a result using the previous moov_main.js, if it exists.
  • moov_rewriter v2.0.5
    • Advanced Rewriter files renamed:
      • request_main.js is now called: moov_request_header_transform.js
      • response_main.js is now called: moov_response_header_transform.js
    • Single Domain Project Rewriting is Enabled.