Wisdom.WisdomConfiguration


Linking, Configuring and Initializing Wisdom:

Your scripts SHOULD define a global object called "wisdomConfiguration", with member property values customized from the template below.

Here is an example of the top of an HTML page that includes and configures wisdom to be forceful in the creation of it's objects and to be silent about it's activities (such as overriding pre-existing objects that may have been placed by other middleware):

<html>
   <head>
      <title>Wisdom Test Page</title>
      <link rel="stylesheet" href="wisdom_release_style-0.3.css" />
   </head>
<body>
    <script type="text/javascript">

       // Here we configure the wisdom library.
       // This snippet could be in the HTML head, or anywhere else
       // as long as it comes before the inclusion of the wisdom library script.

       var wisdomConfiguration = {
          applicationName: "Test Page",
          expectedWisdomVersionMajor: 0,
          expectedWisdomVersionMinor: 3,
          consoleElementId: "wisdomConsole",
          alertOnMissingConsoleElement: true,
          existingConsoleWarning: false,
          overwriteConsole: true,
          overwriteConsoleWarning: false
       };	
    </script>
    <!-- Include wisdom library -->
    <script type="text/javascript" src="wisdom_release_min-0.3.js"></script>
   ...
   ...

When the wisdom library is parsed and initialized, the properties of the wisdomConfiguration object will be used to set up the new instance of the wisdom module, influencing it's low-level behaviour. The options provided will be remembered and available later as wisdom.options.

By default wisdom makes certain checks of it's environment as it starts up, and these options can be used to control what sort of checks it makes, and how it reports these things to the user (if at all).

The wisdomConfiguration object SHOULD be declared and it's properties initialized before the wisdom library script itself is included into the page context, or otherwise a set of somewhat paranoid defaults will be used, which can cause irritating alert boxes to pop up in certain instances. These messages inform the user of various technical details which can be useful during debugging and at the early development stages, but once you understand the implications of these messages you can decide whether or not to disable them.

Using the DOM Location object, it is possible to control the values of these options dynamically using the query values provided in the page URL. For example, one could modify the expected wisdom version with an URL like so if the correct plumbing to examine page arguments was put in place:

 http://mypage.com/page.html?wisdomExpectedMajorVersion=0&wisomExpectedMinorVersion=4

If an option value is not included, it will default as below:

 applicationName: "Wisdom-based Application"
 expectedWisdomVersionMajor: $YOUR_LIBRARY_VERSION
 expectedWisdomVersionMinor: $YOUR_LIBRARY_VERSION
 consoleElementId: "WisdomConsole"
 alertOnMissingConsoleElement: true
 existingConsoleWarning: true
 overwriteConsole: false
 overwriteConsoleWarning: true

See the wisdom.options reference for the details on the behaviour of each option value.


This is part of the Reference Documentation for the Wisdom Javascript Library? (or wisdom.js)