Module: $wk$

$wk$

Author:
  • Wolfgang Kowarschick
Source:

Classes

WKcAysnc
WKcClass
WKcEnum

Members

<static, readonly> $name$ :String

The name of the library: WKlib
Type:
  • String
Source:

<static> $root$

The $root$ object of the application.
Source:

<static, readonly> $version$ :Object

The version of the library: 001.00
Type:
  • Object
Properties:
Name Type Description
$version$.version String The version number.
$version$.subversion String The subversion number.
$version$.name String The version name.
Source:

Methods

<static> $C$(p_name, p_value, p_getter)

$C$ is an object that contains constant values.
Parameters:
Name Type Argument Default Description
p_name String The name of the constant to be stored.
p_value Object The value of the constant to be stored.
p_getter Boolean <optional>
false If p_value contains a (parameterless) function and p_getter===true then for p_name a getter method is stored that calls that function within the scope of $C$.
Source:

<static> $E$(p_event_type)

$E$ is an object that contains event types.
Parameters:
Name Type Description
p_event_type String The event type to be stored in $E$.
Source:

<static> $new$(p_constructor, p_arguments) → {Object}

An object created by calling $new$(Class, [1, 2, 3]) is identical to an object created with new Class(1, 2, 3).
Parameters:
Name Type Description
p_constructor function A function to be used as constructor.
p_arguments Array An array of arguments to be passed to the constructor
Source:
See:
Returns:
The newly constructed object.
Type
Object

<static> getOwnPropertyDescriptor(p_object, p_property) → {Object}

An extended version of Object.getOwnPropertyDescriptor.
Parameters:
Name Type Description
p_object String The object a property descriptor of which is either to be read or to be defined.
p_property String The property of p_object which is to be accessed.
Source:
Returns:
The property descriptor of p_object.p_property, if defined.
Type
Object

<static> getPropertyDescriptor(p_object, p_property) → {Object}

An extended version of Object.getPropertyDescriptor.
Parameters:
Name Type Description
p_object String The object a property descriptor of which is either to be read or to be defined.
p_property String The property of p_object which is to be accessed.
Source:
Returns:
The property descriptor of p_object.p_property, if defined.
Type
Object

<static> mixin(p_target, p_source, p_filter)

Recursively mixes properties of a source object into a target object. Overridable properties are overridden, others not.
Parameters:
Name Type Description
p_target Object | String An arbitray object.
p_source Object | String Another arbitray object (or a path name of an object) the properties of which are to be recursively mixed into p_target.
p_filter function A function code>function(p_source [,p_target]) that filters p_source before mixing it into p_target.
Source:

<static> moduleAdd(arguments)

Adds one ore more modules to the module list of $wk$. Those modules can be loaded and added to $wk$ sandbox environments lateron.
Parameters:
Name Type Argument Description
arguments Array Default parameter
arguments[i].name String The unique name of the module (including the name of the module package).
arguments[i].type String <optional>
The type of the module ($wk$.MODULE_TYPE): js, css, json, xml, ...
arguments[i].url String <optional>
The URL, where the definition of the module can be found. Usually computed automatically (determined by the package root, package name ...)
arguments[i].loader function <optional>
A function function(p_callback) to load the module (this) from url. Finally the callback function must be invoked. For js, css, json and xml there exists default loaders. (TBD: css, xml)
arguments[i].module Object <optional>
The module itself. If it is not stated explicitly, it is loaded, when the module is accessed for the first time.
arguments[i].init function <optional>
A function function(p_callback) that is called, when the module has been loaded. The callback function passed must be called, when the module has been initialized.
arguments[i].required Array <optional>
A list of module that must be loaded before the p_module can be loaded.
Source:

<static> pkg(p_name, p_create) → {Object|null}

Creates a chain of nested objects.

For instance: The following function call

  $wk$.pkg("ldvcs.view");
results in the creation of two objects (if they do not already exist):
  ldvcs
  ldvcs.view

Parameters:
Name Type Argument Default Description
p_name String A package name, i.e. one or more name literals separated by dots.
p_create String <optional>
true Indicates, whether or not to create the package, if it does not exists
Source:
Returns:
The last package object of the package object chain or null if the package does not exist.
Type
Object | null

<static> rootPackage(p_roots)

Creates root packages.
Parameters:
Name Type Description
p_roots Object An object containing one or many descriptors of root packages.
Properties
Name Type Description
NAME Object Each attribute of p_root describes the root package named NAME.
Properties
Name Type Argument Default Description
root Object <optional>
<system root object> The top level object where the package modules can be found.
url Object <optional>
The top level URL where the source files of the package modules can be found. If no url is passed, the modules of that package cannot be loaded but must be created directly.
packagePath function <optional>
ppath A function that maps a package name to a path name that is appended to p_root.NAME.url. The default function ppath deletes all $-symbols from the name, replaces dots (".") by slashes ("/").
packageIndexFile String <optional>
"index.json" The name of the json file, where the list of al
moduleFile function <optional>
mfile A function f(p_name, p_type) that maps a module name to a file name. The default function mfile applies ppath (see above) to p_name and then adds "." + p_type to the path name.
Source:

<static> rootPackageInit(p_root_name, p_init)

Initializes a root package (which must have been created by $wk$.rootPackage before) by adding information about all modules and subpackages that are directly or indirectly members of that package. TBD: Description of the syntax of p_init.
Parameters:
Name Type Argument Description
p_root_name String The name of the root package.
p_init JSON <optional>
The initialization data describing the modules to be added. p_init is an object each property of which describes a module or a subpackage that is to be loaded. If no initialization object is stated, it is tried to load the JSON file package.json from the URL where the root package is stored. If this file exists, its content is used to initialize the root package.
Source:

<static> setProperty(p_object, p_property, p_descriptor, p_mixin) → {Object}

An extended version of Object.defineProperty.

The property descriptor set via p_descriptor or returned by $wk$.setProperty may contain several attributes:

configurable (boolean, default: false)
see Object.defineProperty or Object.getOwnPropertyDescriptor
enumerable (boolean, default: false)
see Object.defineProperty or Object.getOwnPropertyDescriptor
value (any JavaScript value, default: undefined)
see Object.defineProperty or Object.getOwnPropertyDescriptor
writable (boolean, default: true)
see Object.defineProperty or Object.getOwnPropertyDescriptor
get (Function, default: undefined)
see Object.defineProperty or Object.getOwnPropertyDescriptor
set (Function, default: undefined)
see Object.defineProperty or Object.getOwnPropertyDescriptor
overridable (boolean, default: false)
Indicates whether the property value may be overriden by $wk$.mixin
If a setter or getter function has been defined but not both, then an error is thrown whenever the undefined method is tried to be invoked.

Parameters:
Name Type Argument Default Description
p_object String The object a property descriptor of which is either to be read or to be defined.
p_property String The property of p_object which is to be accessed.
p_descriptor Object The descriptor to be asigned to or to be mixed into p_object.p_property
p_mixin Object <optional>
false If false an existing desctiptor is overridden, otherwise the new descriptor is mixed into the old one.
Source:
Returns:
this
Type
Object
W. Kowarschick © 2013 (CC BY-NC-SA 3.0: http://creativecommons.org/licenses/by-nc-sa/3.0/)
Documentation generated by JSDoc 3.3.0-dev on Sat Oct 05 2013 15:14:39 GMT+0200 (MESZ) using the DocStrap template.