- Copyright:
- 2012-2013, Wolfgang Kowarschick
Redistribution and use in source and binary forms, with or without modification, are permitted under the terms of the Creative Commons License Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0: http://creativecommons.org/licenses/by-nc-sa/3.0/).
- 2012-2013, Wolfgang Kowarschick
- Source:
Classes
Members
-
<static, readonly> $name$ :String
-
The name of the library: WKlib
Type:
- String
-
<static> $root$
-
The $root$ object of the application.
-
<static, readonly> $version$ :Object
-
The version of the library: 001.00
Type:
- Object
Methods
-
<static> $C$(p_name, p_value, p_getter)
-
$C$is an object that contains constant values.Parameters:
Name Type Argument Default Description p_nameString The name of the constant to be stored. p_valueObject The value of the constant to be stored. p_getterBoolean <optional>
false If p_valuecontains a (parameterless) function andp_getter===truethen forp_namea getter method is stored that calls that function within the scope of$C$. -
<static> $E$(p_event_type)
-
$E$is an object that contains event types.Parameters:
Name Type Description p_event_typeString The event type to be stored in $E$. -
<static> $new$(p_constructor, p_arguments) → {Object}
-
An object created by calling
$new$(Class, [1, 2, 3])is identical to an object created withnew Class(1, 2, 3).Parameters:
Name Type Description p_constructorfunction A function to be used as constructor. p_argumentsArray 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_objectString The object a property descriptor of which is either to be read or to be defined. p_propertyString The property of p_objectwhich is to be accessed.Returns:
The property descriptor ofp_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_objectString The object a property descriptor of which is either to be read or to be defined. p_propertyString The property of p_objectwhich is to be accessed.Returns:
The property descriptor ofp_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_targetObject | String An arbitray object. p_sourceObject | String Another arbitray object (or a path name of an object) the properties of which are to be recursively mixed into p_target.p_filterfunction A function code>function(p_source [,p_target]) that filters p_sourcebefore mixing it intop_target. -
<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 argumentsArray Default parameter arguments[i].nameString The unique name of the module (including the name of the module package). arguments[i].typeString <optional>
The type of the module ( $wk$.MODULE_TYPE):js,css,json,xml, ...arguments[i].urlString <optional>
The URL, where the definition of the module can be found. Usually computed automatically (determined by the package root, package name ...) arguments[i].loaderfunction <optional>
A function function(p_callback)to load the module (this) fromurl. Finally the callback function must be invoked. Forjs,css,jsonandxmlthere exists default loaders. (TBD: css, xml)arguments[i].moduleObject <optional>
The module itself. If it is not stated explicitly, it is loaded, when the module is accessed for the first time. arguments[i].initfunction <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].requiredArray <optional>
A list of module that must be loaded before the p_modulecan be loaded. -
<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_nameString A package name, i.e. one or more name literals separated by dots. p_createString <optional>
true Indicates, whether or not to create the package, if it does not exists Returns:
The last package object of the package object chain ornullif the package does not exist.- Type
- Object | null
-
<static> rootPackage(p_roots)
-
Creates root packages.
Parameters:
Name Type Description p_rootsObject An object containing one or many descriptors of root packages. Properties
Name Type Description NAMEObject Each attribute of p_rootdescribes the root package namedNAME.Properties
Name Type Argument Default Description rootObject <optional>
<system root object> The top level object where the package modules can be found. urlObject <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. packagePathfunction <optional>
ppath A function that maps a package name to a path name that is appended to p_root.NAME.url. The default functionppathdeletes all$-symbols from the name, replaces dots (".") by slashes ("/").packageIndexFileString <optional>
"index.json" The name of the json file, where the list of al moduleFilefunction <optional>
mfile A function f(p_name, p_type)that maps a module name to a file name. The default functionmfileappliesppath(see above) top_nameand then adds"." + p_typeto the path name. -
<static> rootPackageInit(p_root_name, p_init)
-
Initializes a root package (which must have been created by
$wk$.rootPackagebefore) by adding information about all modules and subpackages that are directly or indirectly members of that package. TBD: Description of the syntax ofp_init.Parameters:
Name Type Argument Description p_root_nameString The name of the root package. p_initJSON <optional>
The initialization data describing the modules to be added. p_initis 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 filepackage.jsonfrom the URL where the root package is stored. If this file exists, its content is used to initialize the root package. -
<static> setProperty(p_object, p_property, p_descriptor, p_mixin) → {Object}
-
An extended version of
Object.defineProperty.The property descriptor set via
p_descriptoror returned by$wk$.setPropertymay contain several attributes:configurable(boolean, default:false)- see
Object.definePropertyorObject.getOwnPropertyDescriptor enumerable(boolean, default:false)- see
Object.definePropertyorObject.getOwnPropertyDescriptor value(any JavaScript value, default:undefined)- see
Object.definePropertyorObject.getOwnPropertyDescriptor writable(boolean, default:true)- see
Object.definePropertyorObject.getOwnPropertyDescriptor get(Function, default:undefined)- see
Object.definePropertyorObject.getOwnPropertyDescriptor set(Function, default:undefined)- see
Object.definePropertyorObject.getOwnPropertyDescriptor overridable(boolean, default:false)- Indicates whether the property value may be overriden by
$wk$.mixin
Parameters:
Name Type Argument Default Description p_objectString The object a property descriptor of which is either to be read or to be defined. p_propertyString The property of p_objectwhich is to be accessed.p_descriptorObject The descriptor to be asigned to or to be mixed into p_object.p_propertyp_mixinObject <optional>
false If falsean existing desctiptor is overridden, otherwise the new descriptor is mixed into the old one.Returns:
this- Type
- Object