Nickolay - JooseX.Namespace.Depended-0.01
Name
JooseX.Namespace.Depended.Manager - A global collection of all resources
SYNOPSIS
JooseX.Namespace.Depended.Manager.my.registerResourceClass('custom-type', JooseX.Namespace.Depended.Resource.Custom)
DESCRIPTION
JooseX.Namespace.Depended.Manager is a global collection of all resources.
Note: Its a pure static class - all its methods and properties are static.
METHODS
registerResourceClass
void registerResourceClass(String type, Class constructor)After you've created your custom resource class, you need to register it with call to this method.
Then you can refer to new resources with the following descriptors:
{
type : 'custom-type',
token : 'some-token'
}
GETTING HELP
This extension is supported via github issues tracker: http://github.com/SamuraiJack/JooseX-Namespace-Depended-Manager/issues
For general Joose questions you can also visit #joose on irc.freenode.org or the forum at: http://joose.it/forum
SEE ALSO
Authoring JooseX.Namespace.Depended
Abstract base resource class: JooseX.Namespace.Depended.Resource
General documentation for Joose: http://openjsan.org/go/?l=Joose
BUGS
All complex software has bugs lurking in it, and this module is no exception.
Please report any bugs through the web interface at http://github.com/SamuraiJack/JooseX-Namespace-Depended-Manager/issues
AUTHORS
Nickolay Platonov nplatonov@cpan.org
COPYRIGHT AND LICENSE
Copyright (c) 2009, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Name
JooseX.Namespace.Depended.Resource - Abstract resource class
SYNOPSIS
//mostly for subclassing only
Class("JooseX.Namespace.Depended.Resource.JooseClass", {
isa : JooseX.Namespace.Depended.Resource,
...
})
DESCRIPTION
JooseX.Namespace.Depended.Resource is an abstract resource class. Its not supposed to be used directly, instead you should use
one of its subclasses.
ATTRIBUTES
attachedTo
Object attachedToAn arbitrary object to which this resource is attached (its a corresponding class in JooseX.Namespace.Depended)
type
String typeA type of resource - plain string.
JooseX.Namespace.Depended.Managermaintain a collection of resource types, accessible
token
String tokenA token of resource - plain string with arbitrary semantic. Each subclass should provide this semantic along with
token -> urlconertion method (locator)
id
String idAn id of resource - is computed as `type + '://' + token'
loading
Boolean loadingA sign whether this resource is currently loading
loaded
Boolean loadedA sign whether this resource is already loaded
ready
Boolean readyA sign whether this resource is considered ready. Resource is ready, when its loaded, and all its dependencies are ready.
loadedFromURL
String loadedFromURLAn url, from which the resource was loaded.
readyListeners
Array[Function] readyListenersAn array of functions, which will be called after this resource becomes ready. Functions will be called sequentially.
dependencies
Object dependenciesAn object containing the dependencies of this resource. Keys are the
ids of resources and the values - the resource instances itself.
onBeforeReady
Function onBeforeReadyA function, which will be called, right after the all dependencies of the resource became ready, but before its own
readyListenerswill be called. It supposed to perform any needed additional actions to post-process the loaded resource.Function will receive two arguments - the 1st is the callback, which should be called when
onBeforeReadywill finish its work. 2nd is the resource instance.
version
r/w Number versionA version of this resource. Currently is handled as Number, this may change in future releases.
requiredVersion
r/w Number requiredVersionA requiredVersion version of this resource. Required here means the maximum version from all references to this resource.
METHODS
addDescriptor
void addDescriptor(Object|String descriptor)Add the resource, described with passed descriptor as the dependency for this resource.
getUrls
String|Array[String] getUrls()Abstract method, will throw an exception if not overriden. It should return the array of urls (or a single url) from which this resource can be potentially loaded. This method should take into account the
JooseX.Namespace.Depended.Manager.my.INCsetting
load
void load(String url, Function onsuccess, Function onerror)Abstract method, will throw an exception if not overriden. It should load the content of the resource from the passed
url. If there was an error during loading (for example file not found) should not throw the exception. Instead, should call theonerrorcontinuation with it (exception instance).After successfull loading, should call the
onsuccesscontinuation with the resource content as 1st argument, andurlas 2nd:onsuccess(text, url)
materialize
void materialize(String resourceBlob)Abstract method, will throw an exception if not overriden. It should "materialize" the resource. The concrete semantic of this action is determined by resource nature. For example this method can create some tag in the DOM tree, or execute the code or something else.
Currently this method is supposed to operate synchronously, this may change in future releases.
SEE ALSO
Web page of this package: http://github.com/SamuraiJack/JooseX-Namespace-Depended-Resource/
General documentation for Joose: http://openjsan.org/go/?l=Joose
BUGS
All complex software has bugs lurking in it, and this module is no exception.
Please report any bugs through the web interface at http://github.com/SamuraiJack/JooseX-Namespace-Depended-Resource/issues
AUTHORS
Nickolay Platonov nplatonov@cpan.org
COPYRIGHT AND LICENSE
Copyright (c) 2009-2010, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Name
JooseX.Namespace.Depended.Materialize.Eval - materializator, which treat the resource content as JavaScript code, and use eval function to evalute it
SYNOPSIS
//generally for consuming only
Class("JooseX.Namespace.Depended.Resource.Custom", {
isa : JooseX.Namespace.Depended.Resource,
does : [ JooseX.Namespace.Depended.Materialize.Eval, ...]
...
})
DESCRIPTION
JooseX.Namespace.Depended.Materialize.Eval is a materializator role. It provide the implementation of materialize method.
SEE ALSO
Authoring JooseX.Namespace.Depended
Abstract base resource class: JooseX.Namespace.Depended.Resource
General documentation for Joose: http://openjsan.org/go/?l=Joose
AUTHORS
Nickolay Platonov nplatonov@cpan.org
COPYRIGHT AND LICENSE
Copyright (c) 2009-2010, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Name
JooseX.Namespace.Depended.Transport.XHRAsync - transport, which use the asynchronous XHR request for resource loading
SYNOPSIS
//generally for consuming only
Class("JooseX.Namespace.Depended.Resource.Custom", {
isa : JooseX.Namespace.Depended.Resource,
does : [ JooseX.Namespace.Depended.Transport.XHRAsync, ...]
...
})
DESCRIPTION
JooseX.Namespace.Depended.Transport.XHRAsync is a transport role. It provide the implementation of load method, which use the
asynchronous XHR request for resource loading.
SEE ALSO
Authoring JooseX.Namespace.Depended
Abstract base resource class: JooseX.Namespace.Depended.Resource
General documentation for Joose: http://openjsan.org/go/?l=Joose
AUTHORS
Nickolay Platonov nplatonov@cpan.org
COPYRIGHT AND LICENSE
Copyright (c) 2009-2010, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Name
JooseX.Namespace.Depended.Transport.XHRSync - transport, which use the synchronous XHR request for resource loading
SYNOPSIS
//generally for consuming only
Class("JooseX.Namespace.Depended.Resource.Custom", {
isa : JooseX.Namespace.Depended.Resource,
does : [ JooseX.Namespace.Depended.Transport.XHRSync, ...]
...
})
DESCRIPTION
JooseX.Namespace.Depended.Transport.XHRSync is a transport role. It provide the implementation of load method, which use the
synchronous XHR request for resource loading.
SEE ALSO
Authoring JooseX.Namespace.Depended
Abstract base resource class: JooseX.Namespace.Depended.Resource
General documentation for Joose: http://openjsan.org/go/?l=Joose
AUTHORS
Nickolay Platonov nplatonov@cpan.org
COPYRIGHT AND LICENSE
Copyright (c) 2009-2010, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Name
JooseX.Namespace.Depended.Transport.ScriptTag - transport, which use the <script> tag for resource loading
SYNOPSIS
//generally for consuming only
Class("JooseX.Namespace.Depended.Resource.Custom", {
isa : JooseX.Namespace.Depended.Resource,
does : [ JooseX.Namespace.Depended.Transport.ScriptTag, ...]
...
})
DESCRIPTION
JooseX.Namespace.Depended.Transport.ScriptTag is a transport role. It provide the implementation of load method, which use the
<script> tag for resource loading. It also overrides the materialize method as <script> tag execute the code along with loading.
SEE ALSO
Authoring JooseX.Namespace.Depended
Abstract base resource class: JooseX.Namespace.Depended.Resource
General documentation for Joose: http://openjsan.org/go/?l=Joose
AUTHORS
Nickolay Platonov nplatonov@cpan.org
COPYRIGHT AND LICENSE
Copyright (c) 2009-2010, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Name
JooseX.Namespace.Depended.Locator.URL - locator, which treat the token property of the resource as URL
SYNOPSIS
//generally for consuming only
Class("JooseX.Namespace.Depended.Resource.Custom", {
isa : JooseX.Namespace.Depended.Resource,
does : [ JooseX.Namespace.Depended.Locator.URL, ...]
...
})
DESCRIPTION
JooseX.Namespace.Depended.Locator.URL is a locator role. It provide the implementation of getUrls method.
SEE ALSO
Authoring JooseX.Namespace.Depended
Abstract base resource class: JooseX.Namespace.Depended.Resource
General documentation for Joose: http://openjsan.org/go/?l=Joose
AUTHORS
Nickolay Platonov nplatonov@cpan.org
COPYRIGHT AND LICENSE
Copyright (c) 2009-2010, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Name
JooseX.Namespace.Depended - a dependencies handling framework for Joose3
SYNOPSIS
Class("MyApp.Widget.Header", {
//declare dependencies
use : [ 'MyApp.Widget.LoginLine', 'MyCompany.Util.Helper'],
does : 'MyApp.Role.Templated',
before : {
initComponent : function () {
//dependencies will be preloaded #1
this.add(new MyApp.Widget.LoginLine({
...
}))
}
},
methods : {
doSomething : function () {
//dependencies will be preloaded #2
MyCompany.Util.Helper.my.doSomething()
}
}
})
or with versions:
Class("MyApp.Widget.Header", {
VERSION : 0.11,
use : [ { 'MyApp.Widget.LoginLine' : 0.03, { 'MyCompany.Util.Helper' : 0.01 } ],
isa : { 'MyApp.Widget.Templated' : 0.01 },
//alternatively
use : {
'MyApp.Widget.LoginLine' : 0.03,
'MyCompany.Util.Helper' : 0.01
}
})
non Joose code also allowed:
Class("MyApp.Widget.Header", {
VERSION : 0.11,
use : [ 'nonjoose://MyApp.Widget.LoginLine' ]
})
from code:
use({ 'MyApp' : 0.01 }, function () {
MyApp.my.run()
})
DESCRIPTION
JooseX.Namespace.Depended is a dependencies handling framework, tightly integrated with Joose3.
It allows you to refer to other (not yet loaded) classes/roles in your class declaration.
Framework is highly customizable, additional resources/transport/materialization modes can be easily added. Please refer to JooseX.Namespace.Depended.Authoring for more information.
By default, framework operates in asynchronous mode, using XHR requests for transport and eval for "materialization".
All edge cases like refering to already loaded class, double loading, etc are handled correctly.
CURRENT DEVELOPMENT STATUS
This framework is considered stable and thoroughly tested (more than 300 unit tests, including stress-test). The use case for "pure" Joose classes will be supported without breaking changes.
However, as its not settled down yet, the syntax for loading non Joose code may be changed any time, without prior notice.
USAGE
Dependency descriptor
All dependencies should be specified with the dependency descriptors. In the simplest case, the descriptor is just a plain string with the name of class:
'MyApp.Widget.Header'
In more complex case, the descriptor is an object, which keys are classes names and values - their's versions:
{
'MyApp.Widget.Header' : 0.03,
'MyApp.Util.Helper' : 0.01
}
Such descriptors can contain several dependencies, though they are limited to Joose classes only.
In general case, the dependency descriptor is an object with the following structure:
{
type : 'joose',
token : 'MyApp.Widget.Header',
version : 0.03
}
Such descriptor can contain exactly one dependency, with the resource of any type.
The rule
General rule is - whereever in your class declaration you can refer to other class (for example in the does builder) - you can specify the
dependency descriptor instead.
This means, that you can specify the dependencies in:
- `meta` builder (!)
- `isa` builder
- `trait` builder
- `does` builder
For example this declaration is perfectly valid:
Class('Some.Class', {
meta : 'My.Meta',
isa : 'Super.Class',
does : {
'Some.Role' : 0.01,
'Some.Other.Role' : 0.02
},
trait : 'Some.Trait',
...
})
Also in any other custom builder (some authoring required)
The framework will scan class declaration for dependencies, pre-load them, then substitute descriptors with actual classes and continue the declaration process.
use builder
Additionaly, you can provide an array of dependencies (or a single dependency) in the use builder:
Class('Some.Class', {
use : [ 'Some.Other.Class', 'Some.Other.Role' ],
...
})
use from code
You can also load the dependencies from code:
use([ 'Some.Class1', 'Some.Class2' ], function () {
var a = new Some.Class1()
var b = new Some.Class2()
})
Class name -> file name conversion
The class name you are refering to, will be converted to file name using this simple scheme:
class name: MyClass
file name: MyClass.js
class name: Some.Class
file name: Some/Class.js
class name: Some.Other.Class
file name: Some/Other/Class.js
Generally each dot is replaced with directory separator, and the 'js' extension is appended to result
The libraries
The framework can look up the classes in several libraries, which are just the directories, containing the source files.
The current list of libraries is stored as an array in: JooseX.Namespace.Depended.Manager.my.INC. Default value is:
JooseX.Namespace.Depended.Manager.my.INC = [ 'lib', '/jsan' ]
You can freely modify this value. For example, if you are running a test harness, as t/index.html, and would like to refer
to your files, which are in lib/, you'll need to add the ../lib entry.
Framework will scan through the libraries list sequentially and attempt to load the class from every entry. Class will be loaded from the first library, which contains the corresponded file. If there are no such file, loading will continue to another entry.
For example, if we are loading class Some.Class, and we have the default setting for libraries, then first it will be tried to load with the following URL:
lib/Some/Class.js
If there are no such file, the 2nd entry will be tried:
/jsan/Some/Class.js
If there are no such file again, the exception will be thrown.
ATTRIBUTE HELPER
This package adds a new attribute initializer: Joose.I.FutureClass
It can be used, when the default value of the attribute should be set to the constructor of some class, which may be not yet loaded on the declaration stage:
Class('MyApp.Widget.Template', {
use : 'MyApp.Util.Helper',
has : {
helperClass : Joose.I.FutureClass('MyApp.Util.Helper')
}
})
GROUPED LOADING MODE
This framework can operate in special mode, in which it can load any class, with any number of dependencies (in-depth), with 2 http requests.
For more information about this mode please refer to http://www.extjs.com/forum/showthread.php?t=69161
This item is currently in TODO list.
GETTING HELP
This extension is supported via github issues tracker: http://github.com/SamuraiJack/JooseX-Namespace-Depended/issues
For general Joose questions you can also visit #joose on irc.freenode.org or the forum at: http://joose.it/forum
SEE ALSO
Base resource class: JooseX.Namespace.Depended.Resource
Web page of this module: http://github.com/SamuraiJack/JooseX-Namespace-Depended/
General documentation for Joose: http://openjsan.org/go/?l=Joose
BUGS
All complex software has bugs lurking in it, and this module is no exception.
Please report any bugs through the web interface at http://github.com/SamuraiJack/JooseX-Namespace-Depended/issues
AUTHORS
Nickolay Platonov nplatonov@cpan.org
COPYRIGHT AND LICENSE
Copyright (c) 2009, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Class('JooseX.Namespace.Depended.Manager', {
my : {
have : {
containResources : [ 'use', 'meta', 'isa', 'does', 'trait', 'traits' ],
INC : [ 'lib', '/jsan' ],
disableCaching : true,
resources : {},
resourceTypes : {},
ANONYMOUS_RESOURCE_COUNTER : 0
},
methods : {
//get own resource of some thing (resource will be also attached to that abstract thing)
//if the something is requesting own resource its considered loaded
getMyResource : function (type, token, me) {
var resource = this.getResource({
type : type,
token : token
})
if (resource.attachedTo && resource.attachedTo != me) throw resource + " is already attached to [" + resource.attachedTo + "]"
resource.attachedTo = me
resource.loaded = true
resource.loading = false
return resource
},
getResource : function (descriptor) {
var type, token, requiredVersion
if (typeof descriptor == 'object') {
type = descriptor.type
token = descriptor.token
requiredVersion = descriptor.version
delete descriptor.version
} else
if (typeof descriptor == 'string') {
var match = /^(\w+):\/\/(.+)/.exec(descriptor)
if (!match) {
type = 'joose'
token = descriptor
} else {
type = match[1]
token = match[2]
}
}
if (!token) {
token = '__ANONYMOUS_RESOURCE__' + this.ANONYMOUS_RESOURCE_COUNTER++
descriptor = undefined
}
var id = type + '://' + token
var resource = this.resources[id]
if (!resource) {
var resourceClass = this.resourceTypes[type]
if (!resourceClass) throw "Unknown resource type: [" + type + "]"
resource = this.resources[id] = new resourceClass(typeof descriptor == 'object' ? descriptor : {
token : token,
type : type
})
}
resource.setRequiredVersion(requiredVersion)
return resource
},
registerResourceClass : function (typeName, resourceClass) {
this.resourceTypes[typeName] = resourceClass
},
use : function (dependenciesInfo, callback, scope) {
var nsManager = Joose.Namespace.Manager.my
var global = nsManager.global
Class({
use : dependenciesInfo,
body : function () {
if (callback) nsManager.executeIn(global, function (ns) {
callback.call(scope || this, ns)
})
}
})
}
}
}
})
use = function (dependenciesInfo, callback, scope) {
JooseX.Namespace.Depended.Manager.my.use(dependenciesInfo, callback, scope)
}
Joose.I.FutureClass = function (className) { return function () { return eval(className) } }
/**
Name
====
JooseX.Namespace.Depended.Manager - A global collection of all resources
SYNOPSIS
========
JooseX.Namespace.Depended.Manager.my.registerResourceClass('custom-type', JooseX.Namespace.Depended.Resource.Custom)
DESCRIPTION
===========
`JooseX.Namespace.Depended.Manager` is a global collection of all resources.
**Note:** Its a pure [static](http://openjsan.org/go?l=Joose.Manual.Static) class - all its methods and properties are static.
METHODS
=======
### registerResourceClass
> `void registerResourceClass(String type, Class constructor)`
> After you've created your custom resource class, you need to register it with call to this method.
> Then you can refer to new resources with the following descriptors:
{
type : 'custom-type',
token : 'some-token'
}
GETTING HELP
============
This extension is supported via github issues tracker: <http://github.com/SamuraiJack/JooseX-Namespace-Depended-Manager/issues>
For general Joose questions you can also visit #joose on irc.freenode.org or the forum at: [http://joose.it/forum](http://joose.it/forum)
SEE ALSO
========
Authoring [JooseX.Namespace.Depended](Authoring.html)
Abstract base resource class: [JooseX.Namespace.Depended.Resource](Resource.html)
General documentation for Joose: <http://openjsan.org/go/?l=Joose>
BUGS
====
All complex software has bugs lurking in it, and this module is no exception.
Please report any bugs through the web interface at [http://github.com/SamuraiJack/JooseX-Namespace-Depended-Manager/issues](http://github.com/SamuraiJack/JooseX-Namespace-Depended-Manager/issues)
AUTHORS
=======
Nickolay Platonov [nplatonov@cpan.org](mailto:nplatonov@cpan.org)
COPYRIGHT AND LICENSE
=====================
Copyright (c) 2009, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
;
Class('JooseX.Namespace.Depended.Resource', {
has : {
attachedTo : null,
type : null,
token : null,
id : null,
loading : false,
loaded : false,
ready : false,
loadedFromURL : null,
readyListeners : Joose.I.Array,
dependencies : Joose.I.Object,
onBeforeReady : { is : 'rw', init : null },
readyDelegated : false,
version : { is : 'rw', init : null },
requiredVersion : { is : 'rw', init : null }
},
after: {
initialize: function () {
if (!this.id) this.id = this.type + '://' + this.token
}
},
methods: {
setOnBeforeReady : function (func) {
if (this.onBeforeReady) throw "Can't redefine 'onBeforeReady' for " + this
this.onBeforeReady = func
},
setVersion : function (version) {
if (!version) return
if (this.version) throw "Cant redefine version of " + this
var requiredVersion = this.requiredVersion
if (requiredVersion && version < requiredVersion) throw "Versions conflict on " + this + " required [" + requiredVersion + "], got [" + version + "]"
this.version = version
},
setRequiredVersion : function (version) {
if (!version) return
var requiredVersion = this.requiredVersion
if (!requiredVersion || version > requiredVersion)
if (this.isLoaded() || this.loading)
throw "Cant increase required version - " + this + " is already loaded"
else
this.requiredVersion = version
},
toString : function () {
return "Resource: id=[" + this.id + "], type=[" + this.meta.name + "]"
},
addDescriptor : function (descriptor) {
var resource = JooseX.Namespace.Depended.Manager.my.getResource(descriptor)
//if there is already such dependency or the resource is ready
if (this.dependencies[resource.id] || resource.ready) return
var me = this
//pushing listener to the end(!) of the list
resource.readyListeners.push(function () {
delete me.dependencies[resource.id]
me.checkReady()
})
//adding dependency
this.dependencies[resource.id] = resource
//we are not ready, since there are depedencies to load
this.ready = false
},
handleDependencies : function () {
// || {} required for classes on which this Role was applied after they were created - they have this.dependencies not initialized
Joose.O.eachOwn(this.dependencies || {}, function (resource) {
resource.handleLoad()
})
this.checkReady()
},
checkReady : function () {
if (!Joose.O.isEmpty(this.dependencies)) return
if (this.onBeforeReady) {
if (!this.readyDelegated) {
this.readyDelegated = true
var me = this
this.onBeforeReady(function(){
me.fireReady()
}, me)
}
} else
this.fireReady()
},
fireReady: function () {
var me = this
setTimeout(function () {
me.ready = true
var listeners = me.readyListeners || []
me.readyListeners = []
Joose.A.each(listeners, function (listener) {
listener()
})
}, 0)
},
isLoaded : function () {
return this.loaded || this.ready
},
handleLoad: function() {
if (this.isLoaded()) {
this.checkReady()
return
}
if (this.loading) return
this.loading = true
var urls = Joose.O.wantArray(this.getUrls())
var me = this
var onsuccess = function (resourceBlob, url) {
me.loaded = true
me.loading = false
me.loadedFromURL = url
me.materialize(resourceBlob)
me.checkReady()
}
var onerror = function (e) {
//if no more urls
if (!urls.length) throw me + " not found"
me.load(urls.shift(), onsuccess, onerror)
}
this.load(urls.shift(), onsuccess, onerror)
},
getUrls: function () {
throw "Abstract resource method 'getUrls' was called"
},
load : function (url, onsuccess, onerror) {
throw "Abstract resource method 'load' was called"
},
materialize : function (resourceBlob) {
throw "Abstract resource method 'materialize' was called"
}
}
})
/**
Name
====
JooseX.Namespace.Depended.Resource - Abstract resource class
SYNOPSIS
========
//mostly for subclassing only
Class("JooseX.Namespace.Depended.Resource.JooseClass", {
isa : JooseX.Namespace.Depended.Resource,
...
})
DESCRIPTION
===========
`JooseX.Namespace.Depended.Resource` is an abstract resource class. Its not supposed to be used directly, instead you should use
one of its subclasses.
ATTRIBUTES
==========
### attachedTo
> `Object attachedTo`
> An arbitrary object to which this resource is attached (its a corresponding class in JooseX.Namespace.Depended)
### type
> `String type`
> A type of resource - plain string. `JooseX.Namespace.Depended.Manager` maintain a collection of resource types, accessible
### token
> `String token`
> A token of resource - plain string with arbitrary semantic. Each subclass should provide this semantic along with `token -> url` conertion method (locator)
### id
> `String id`
> An id of resource - is computed as `type + '://' + token'
### loading
> `Boolean loading`
> A sign whether this resource is currently loading
### loaded
> `Boolean loaded`
> A sign whether this resource is already loaded
### ready
> `Boolean ready`
> A sign whether this resource is considered ready. Resource is ready, when its loaded, and all its dependencies are ready.
### loadedFromURL
> `String loadedFromURL`
> An url, from which the resource was loaded.
### readyListeners
> `Array[Function] readyListeners`
> An array of functions, which will be called after this resource becomes ready. Functions will be called sequentially.
### dependencies
> `Object dependencies`
> An object containing the dependencies of this resource. Keys are the `id`s of resources and the values - the resource instances itself.
### onBeforeReady
> `Function onBeforeReady`
> A function, which will be called, right after the all dependencies of the resource became ready, but before its own `readyListeners` will be called.
It supposed to perform any needed additional actions to post-process the loaded resource.
> Function will receive two arguments - the 1st is the callback, which should be called when `onBeforeReady` will finish its work. 2nd is the resource instance.
### version
> `r/w Number version`
> A version of this resource. Currently is handled as Number, this may change in future releases.
### requiredVersion
> `r/w Number requiredVersion`
> A *requiredVersion* version of this resource. Required here means the maximum version from all references to this resource.
METHODS
=======
### addDescriptor
> `void addDescriptor(Object|String descriptor)`
> Add the resource, described with passed descriptor as the dependency for this resource.
### getUrls
> `String|Array[String] getUrls()`
> Abstract method, will throw an exception if not overriden. It should return the array of urls (or a single url) from which this resource can be potentially loaded.
This method should take into account the `JooseX.Namespace.Depended.Manager.my.INC` setting
### load
> `void load(String url, Function onsuccess, Function onerror)`
> Abstract method, will throw an exception if not overriden. It should load the content of the resource from the passed `url`. If there was an error during loading
(for example file not found) should not throw the exception. Instead, should call the `onerror` continuation with it (exception instance).
> After successfull loading, should call the `onsuccess` continuation with the resource content as 1st argument, and `url` as 2nd: `onsuccess(text, url)`
### materialize
> `void materialize(String resourceBlob)`
> Abstract method, will throw an exception if not overriden. It should "materialize" the resource. The concrete semantic of this action is determined by resource nature.
For example this method can create some tag in the DOM tree, or execute the code or something else.
> Currently this method is supposed to operate synchronously, this may change in future releases.
SEE ALSO
========
Web page of this package: <http://github.com/SamuraiJack/JooseX-Namespace-Depended-Resource/>
General documentation for Joose: <http://openjsan.org/go/?l=Joose>
BUGS
====
All complex software has bugs lurking in it, and this module is no exception.
Please report any bugs through the web interface at <http://github.com/SamuraiJack/JooseX-Namespace-Depended-Resource/issues>
AUTHORS
=======
Nickolay Platonov <nplatonov@cpan.org>
COPYRIGHT AND LICENSE
=====================
Copyright (c) 2009-2010, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
;
Role('JooseX.Namespace.Depended.Materialize.Eval', {
requires : [ 'handleLoad' ],
methods : {
materialize : function (resourceBlob) {
eval.call(Joose.top, resourceBlob)
}
}
})
/**
Name
====
JooseX.Namespace.Depended.Materialize.Eval - materializator, which treat the resource content as JavaScript code, and use `eval` function to evalute it
SYNOPSIS
========
//generally for consuming only
Class("JooseX.Namespace.Depended.Resource.Custom", {
isa : JooseX.Namespace.Depended.Resource,
does : [ JooseX.Namespace.Depended.Materialize.Eval, ...]
...
})
DESCRIPTION
===========
`JooseX.Namespace.Depended.Materialize.Eval` is a materializator role. It provide the implementation of `materialize` method.
SEE ALSO
========
Authoring [JooseX.Namespace.Depended](../Authoring.html)
Abstract base resource class: [JooseX.Namespace.Depended.Resource](../Resource.html)
General documentation for Joose: <http://openjsan.org/go/?l=Joose>
AUTHORS
=======
Nickolay Platonov <nplatonov@cpan.org>
COPYRIGHT AND LICENSE
=====================
Copyright (c) 2009-2010, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/;
////XXX several failures in FF(?)
//
//Role('JooseX.Namespace.Depended.Materialize.Script', {
//
// requires : [ 'handleLoad' ],
//
// methods : {
//
// materialize : function (resourceBlob) {
// var loaderNode = document.createElement("script")
//
//// loaderNode.onload = loaderNode.onreadystatechange = function () {
//// if (!loaderNode.readyState || loaderNode.readyState == "loaded" || loaderNode.readyState == "complete" || loaderNode.readyState == 4 && loaderNode.status == 200)
//// //surely for IE6..
//// setTimeout(ready, 1)
//// }
//
// loaderNode.text = resourceBlob
//// document.getElementsByTagName("head")[0].appendChild(loaderNode)
//
// //adding to body, because Safari do not create HEAD for iframe's documents
// document.body.appendChild(loaderNode)
// }
//
// }
//
//});
Role('JooseX.Namespace.Depended.Transport.XHRAsync', {
requires : [ 'handleLoad' ],
override : {
load: function (url, onsuccess, onerror) {
var req = new JooseX.SimpleRequest()
try {
req.getText(url, true, function (success, text) {
if (!success) {
onerror(this + " not found")
return
}
onsuccess(text, url)
})
} catch (e) {
onerror(e)
}
}
}
})
/**
Name
====
JooseX.Namespace.Depended.Transport.XHRAsync - transport, which use the asynchronous XHR request for resource loading
SYNOPSIS
========
//generally for consuming only
Class("JooseX.Namespace.Depended.Resource.Custom", {
isa : JooseX.Namespace.Depended.Resource,
does : [ JooseX.Namespace.Depended.Transport.XHRAsync, ...]
...
})
DESCRIPTION
===========
`JooseX.Namespace.Depended.Transport.XHRAsync` is a transport role. It provide the implementation of `load` method, which use the
asynchronous XHR request for resource loading.
SEE ALSO
========
Authoring [JooseX.Namespace.Depended](../Authoring.html)
Abstract base resource class: [JooseX.Namespace.Depended.Resource](../Resource.html)
General documentation for Joose: <http://openjsan.org/go/?l=Joose>
AUTHORS
=======
Nickolay Platonov <nplatonov@cpan.org>
COPYRIGHT AND LICENSE
=====================
Copyright (c) 2009-2010, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/;
Role('JooseX.Namespace.Depended.Transport.XHRSync', {
requires : [ 'handleLoad' ],
override : {
load: function (url, onsuccess, onerror) {
var req = new JooseX.SimpleRequest()
var text;
try {
text = req.getText(url)
} catch (e) {
onerror(e)
return
}
onsuccess(text, url)
}
}
})
/**
Name
====
JooseX.Namespace.Depended.Transport.XHRSync - transport, which use the synchronous XHR request for resource loading
SYNOPSIS
========
//generally for consuming only
Class("JooseX.Namespace.Depended.Resource.Custom", {
isa : JooseX.Namespace.Depended.Resource,
does : [ JooseX.Namespace.Depended.Transport.XHRSync, ...]
...
})
DESCRIPTION
===========
`JooseX.Namespace.Depended.Transport.XHRSync` is a transport role. It provide the implementation of `load` method, which use the
synchronous XHR request for resource loading.
SEE ALSO
========
Authoring [JooseX.Namespace.Depended](../Authoring.html)
Abstract base resource class: [JooseX.Namespace.Depended.Resource](../Resource.html)
General documentation for Joose: <http://openjsan.org/go/?l=Joose>
AUTHORS
=======
Nickolay Platonov <nplatonov@cpan.org>
COPYRIGHT AND LICENSE
=====================
Copyright (c) 2009-2010, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/;
Role('JooseX.Namespace.Depended.Transport.ScriptTag', {
requires : [ 'handleLoad' ],
override : {
load: function (url, onsuccess, onerror) {
var loaderNode = document.createElement("script")
// if (Joose.is_IE) var errorTimeOut
loaderNode.onload = loaderNode.onreadystatechange = function () {
if (!loaderNode.readyState || loaderNode.readyState == "loaded" || loaderNode.readyState == "complete" || loaderNode.readyState == 4 && loaderNode.status == 200)
//surely for IE6..
setTimeout(function () { onsuccess(loaderNode.text, url) }, 1)
}
loaderNode.setAttribute("type", "text/javascript")
loaderNode.setAttribute("src", url)
document.getElementsByTagName("head")[0].appendChild(loaderNode)
},
materialize : function () {
}
}
})
/**
Name
====
JooseX.Namespace.Depended.Transport.ScriptTag - transport, which use the <script> tag for resource loading
SYNOPSIS
========
//generally for consuming only
Class("JooseX.Namespace.Depended.Resource.Custom", {
isa : JooseX.Namespace.Depended.Resource,
does : [ JooseX.Namespace.Depended.Transport.ScriptTag, ...]
...
})
DESCRIPTION
===========
`JooseX.Namespace.Depended.Transport.ScriptTag` is a transport role. It provide the implementation of `load` method, which use the
<script> tag for resource loading. It also overrides the `materialize` method as <script> tag execute the code along with loading.
SEE ALSO
========
Authoring [JooseX.Namespace.Depended](../Authoring.html)
Abstract base resource class: [JooseX.Namespace.Depended.Resource](../Resource.html)
General documentation for Joose: <http://openjsan.org/go/?l=Joose>
AUTHORS
=======
Nickolay Platonov <nplatonov@cpan.org>
COPYRIGHT AND LICENSE
=====================
Copyright (c) 2009-2010, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/;
Class('JooseX.Namespace.Depended.Resource.JooseClass', {
isa : JooseX.Namespace.Depended.Resource,
does : [ JooseX.Namespace.Depended.Transport.XHRAsync, JooseX.Namespace.Depended.Materialize.Eval ],
methods : {
getUrls : function () {
var urls = []
var className = this.token.split('.')
Joose.A.each(JooseX.Namespace.Depended.Manager.my.INC, function (libroot) {
libroot = libroot.replace(/\/$/, '')
urls.push( [ libroot ].concat(className).join('/') + '.js' + (JooseX.Namespace.Depended.Manager.my.disableCaching ? '?disableCaching=' + new Date().getTime() : '') )
})
return urls
}
},
override : {
addDescriptor : function (descriptor) {
if (typeof descriptor == 'object' && !descriptor.token)
Joose.O.eachOwn(descriptor, function (version, name) {
this.addDescriptor({
type : 'joose',
token : name,
version : version
})
}, this)
else
this.SUPER(descriptor)
}
}
})
JooseX.Namespace.Depended.Manager.my.registerResourceClass('joose', JooseX.Namespace.Depended.Resource.JooseClass)
;
Class('JooseX.Namespace.Depended.Resource.NonJoose', {
isa : JooseX.Namespace.Depended.Resource.JooseClass,
have : {
presence : null
},
after: {
initialize: function () {
var me = this
if (!this.presence) this.presence = function () {
return eval(me.token)
}
}
},
methods : {
isLoaded : function () {
var isPresent = false
try {
isPresent = this.presence()
} catch (e) {
}
return isPresent || this.SUPER()
}
}
})
JooseX.Namespace.Depended.Manager.my.registerResourceClass('nonjoose', JooseX.Namespace.Depended.Resource.NonJoose)
;
//describes the behavior of resource, who's token is an URL
Role('JooseX.Namespace.Depended.Locator.URL', {
methods : {
getUrls : function () {
var url = this.token
if (/^http/.test(url) || /^\//.test(url)) return [ url ]
var urls = []
Joose.A.each(JooseX.Namespace.Depended.Manager.my.INC, function (libroot) {
urls.push(libroot.replace(/\/?$/, '/') + url)
})
return urls
}
}
})
/**
Name
====
JooseX.Namespace.Depended.Locator.URL - locator, which treat the `token` property of the resource as URL
SYNOPSIS
========
//generally for consuming only
Class("JooseX.Namespace.Depended.Resource.Custom", {
isa : JooseX.Namespace.Depended.Resource,
does : [ JooseX.Namespace.Depended.Locator.URL, ...]
...
})
DESCRIPTION
===========
`JooseX.Namespace.Depended.Locator.URL` is a locator role. It provide the implementation of `getUrls` method.
SEE ALSO
========
Authoring [JooseX.Namespace.Depended](../Authoring.html)
Abstract base resource class: [JooseX.Namespace.Depended.Resource](../Resource.html)
General documentation for Joose: <http://openjsan.org/go/?l=Joose>
AUTHORS
=======
Nickolay Platonov <nplatonov@cpan.org>
COPYRIGHT AND LICENSE
=====================
Copyright (c) 2009-2010, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/;
Class('JooseX.Namespace.Depended.Resource.ExternalURL', {
isa : JooseX.Namespace.Depended.Resource,
does : [ JooseX.Namespace.Depended.Locator.URL, JooseX.Namespace.Depended.Transport.ScriptTag ],
after : {
initialize : function () {
var url = this.token
if (!/^http/.test(url) && !/^\//.test(url)) throw "Can't use relative URL for resource [" + this + "]"
}
}
})
JooseX.Namespace.Depended.Manager.my.registerResourceClass('exturl', JooseX.Namespace.Depended.Resource.ExternalURL);
Class('JooseX.Namespace.Depended.Resource.InternalURL', {
isa : JooseX.Namespace.Depended.Resource,
does : [ JooseX.Namespace.Depended.Locator.URL, JooseX.Namespace.Depended.Transport.XHRAsync, JooseX.Namespace.Depended.Materialize.Eval ],
after : {
initialize : function () {
var url = this.token
if (/^http/.test(url) || /^\//.test(url)) throw "Can't use absolute URL for resource [" + this + "]"
}
}
})
JooseX.Namespace.Depended.Manager.my.registerResourceClass('inturl', JooseX.Namespace.Depended.Resource.InternalURL);
Role('JooseX.Namespace.Depended', {
meta : Joose.Managed.Role,
requires : [ 'prepareProperties' ],
have : {
containResources : [ 'use', 'meta', 'isa', 'does', 'trait', 'traits' ]
},
override: {
prepareProperties : function (name, extend, defaultMeta, callback) {
if (name && typeof name != 'string') {
extend = name
name = null
}
extend = extend || {}
var summaredDeps = []
var extendMy = extend.my
//gathering all the related resourses from various builders
//also gathering resourses of 'my'
Joose.A.each(this.containResources, function (propName) {
this.collectDependencies(extend[propName], summaredDeps)
if (extendMy && extendMy[propName]) this.collectDependencies(extendMy[propName], summaredDeps)
}, this)
//and from externally collected additional resources
this.alsoDependsFrom(extend, summaredDeps)
var resource = JooseX.Namespace.Depended.Manager.my.getResource({
type : 'joose',
token : name
})
if (extend.VERSION) {
resource.setVersion(extend.VERSION)
delete extend.VERSION
}
//BEGIN executes right after the all dependencies are loaded, but before this module becomes ready (before body())
//this allows to manually control the "ready-ness" of module (custom pre-processing)
//BEGIN receives the function (callback), which should be called at the end of custom processing
if (extend.BEGIN) {
resource.setOnBeforeReady(extend.BEGIN)
delete extend.BEGIN
}
Joose.A.each(summaredDeps, function (descriptor) {
resource.addDescriptor(descriptor)
})
setTimeout(function () {
resource.handleDependencies()
}, 0)
//skip constructing for classes w/o dependencies
if (Joose.O.isEmpty(resource.dependencies)) {
this.inlineDependencies(extend)
return this.SUPER(name, extend, defaultMeta, callback)
}
var me = this
//unshift is critical for correct order of readyListerens processing!
//constructing is delaying until resource will become ready
resource.readyListeners.unshift(function () {
me.inlineDependencies(extend)
me.prepareProperties(name, extend, defaultMeta, callback)
})
return this.create(name, Joose.Namespace.Keeper, {})
},
create : function () {
var meta = this.SUPERARG(arguments).meta
meta.resource = meta.resource || JooseX.Namespace.Depended.Manager.my.getMyResource('joose', meta.name, meta.c)
return meta.c
}
},
//eof override
methods : {
alsoDependsFrom : function (extend, summaredDeps) {
},
collectDependencies : function (from, to) {
Joose.A.each(Joose.O.wantArray(from), function (descriptor) {
if (descriptor && typeof descriptor != 'function') to.push(descriptor)
})
},
inlineDependencies : function (extend) {
this.inlineDeps(extend)
var extendMy = extend.my
if (extendMy) this.inlineDeps(extendMy)
},
inlineDeps : function (extend) {
delete extend.use
Joose.A.each(this.containResources, function (propName) {
if (extend[propName]) {
var descriptors = []
Joose.A.each(Joose.O.wantArray(extend[propName]), function (descriptor, index) {
if (typeof descriptor == 'function')
descriptors.push(descriptor)
else
if (typeof descriptor == 'object')
if (descriptor.token)
descriptors.push(eval(descriptor.token))
else
Joose.O.each(descriptor, function (version, name) {
descriptors.push(eval(name))
})
else
if (typeof descriptor == 'string')
descriptors.push(eval(descriptor))
else
throw "Wrong dependency descriptor format: " + descriptor
})
if (propName != 'isa' && propName != 'meta')
extend[propName] = descriptors
else
if (descriptors.length > 1)
throw "Cant specify several super- or meta- classes"
else
extend[propName] = descriptors[0]
}
})
}
}
})
Joose.Namespace.Manager.meta.extend({
does : JooseX.Namespace.Depended
})
Joose.Namespace.Keeper.meta.extend({
after: {
copyNamespaceState: function (targetClass) {
targetClass.meta.resource = this.resource
}
}
})
/**
Name
====
JooseX.Namespace.Depended - a dependencies handling framework for Joose3
SYNOPSIS
========
Class("MyApp.Widget.Header", {
//declare dependencies
use : [ 'MyApp.Widget.LoginLine', 'MyCompany.Util.Helper'],
does : 'MyApp.Role.Templated',
before : {
initComponent : function () {
//dependencies will be preloaded #1
this.add(new MyApp.Widget.LoginLine({
...
}))
}
},
methods : {
doSomething : function () {
//dependencies will be preloaded #2
MyCompany.Util.Helper.my.doSomething()
}
}
})
or with versions:
Class("MyApp.Widget.Header", {
VERSION : 0.11,
use : [ { 'MyApp.Widget.LoginLine' : 0.03, { 'MyCompany.Util.Helper' : 0.01 } ],
isa : { 'MyApp.Widget.Templated' : 0.01 },
//alternatively
use : {
'MyApp.Widget.LoginLine' : 0.03,
'MyCompany.Util.Helper' : 0.01
}
})
non Joose code also allowed:
Class("MyApp.Widget.Header", {
VERSION : 0.11,
use : [ 'nonjoose://MyApp.Widget.LoginLine' ]
})
from code:
use({ 'MyApp' : 0.01 }, function () {
MyApp.my.run()
})
DESCRIPTION
===========
`JooseX.Namespace.Depended` is a dependencies handling framework, tightly integrated with Joose3.
It allows you to refer to other (not yet loaded) classes/roles in your class declaration.
Framework is highly customizable, additional resources/transport/materialization modes can be easily added.
Please refer to [JooseX.Namespace.Depended.Authoring][authoring] for more information.
By default, framework operates in asynchronous mode, using XHR requests for transport and `eval` for "materialization".
All edge cases like refering to already loaded class, double loading, etc are handled correctly.
CURRENT DEVELOPMENT STATUS
==========================
This framework is considered stable and thoroughly tested (more than 300 unit tests, including stress-test).
The use case for "pure" Joose classes will be supported without breaking changes.
However, as its not settled down yet, the syntax for loading *non Joose* code may be changed any time, without prior notice.
USAGE
=====
Dependency descriptor
---------------------
All dependencies should be specified with the *dependency descriptors*. In the simplest case, the descriptor is just a plain string
with the name of class:
'MyApp.Widget.Header'
In more complex case, the descriptor is an object, which keys are classes names and values - their's versions:
{
'MyApp.Widget.Header' : 0.03,
'MyApp.Util.Helper' : 0.01
}
Such descriptors can contain several dependencies, though they are limited to Joose classes only.
In general case, the dependency descriptor is an object with the following structure:
{
type : 'joose',
token : 'MyApp.Widget.Header',
version : 0.03
}
Such descriptor can contain exactly one dependency, with the resource of any type.
The rule
--------
General rule is - whereever in your class declaration you can refer to other class (for example in the `does` builder) - you can specify the
dependency descriptor instead.
This means, that you can specify the dependencies in:
- `meta` builder (!)
- `isa` builder
- `trait` builder
- `does` builder
For example this declaration is perfectly valid:
Class('Some.Class', {
meta : 'My.Meta',
isa : 'Super.Class',
does : {
'Some.Role' : 0.01,
'Some.Other.Role' : 0.02
},
trait : 'Some.Trait',
...
})
Also in any other custom builder (some [authoring][] required)
The framework will scan class declaration for dependencies, pre-load them, then substitute descriptors with actual classes and continue the declaration process.
`use` builder
-------------
Additionaly, you can provide an array of dependencies (or a single dependency) in the `use` builder:
Class('Some.Class', {
use : [ 'Some.Other.Class', 'Some.Other.Role' ],
...
})
`use` from code
---------------
You can also load the dependencies from code:
use([ 'Some.Class1', 'Some.Class2' ], function () {
var a = new Some.Class1()
var b = new Some.Class2()
})
Class name -> file name conversion
----------------------------------
The class name you are refering to, will be converted to file name using this simple scheme:
class name: MyClass
file name: MyClass.js
class name: Some.Class
file name: Some/Class.js
class name: Some.Other.Class
file name: Some/Other/Class.js
Generally each dot is replaced with directory separator, and the 'js' extension is appended to result
The libraries
-------------
The framework can look up the classes in several *libraries*, which are just the directories, containing the source files.
The current list of libraries is stored as an array in: `JooseX.Namespace.Depended.Manager.my.INC`. Default value is:
JooseX.Namespace.Depended.Manager.my.INC = [ 'lib', '/jsan' ]
You can freely modify this value. For example, if you are running a test harness, as `t/index.html`, and would like to refer
to your files, which are in `lib/`, you'll need to add the `../lib` entry.
Framework will scan through the libraries list sequentially and attempt to load the class from every entry.
Class will be loaded from the first library, which contains the corresponded file. If there are no such file,
loading will continue to another entry.
For example, if we are loading class `Some.Class`, and we have the default setting for libraries, then first it will be tried to load with the following URL:
lib/Some/Class.js
If there are no such file, the 2nd entry will be tried:
/jsan/Some/Class.js
If there are no such file again, the exception will be thrown.
ATTRIBUTE HELPER
================
This package adds a new [attribute initializer](http://openjsan.org/go?l=Joose.Manual.Attributes): `Joose.I.FutureClass`
It can be used, when the default value of the attribute should be set to the constructor of some class,
which may be not yet loaded on the declaration stage:
Class('MyApp.Widget.Template', {
use : 'MyApp.Util.Helper',
has : {
helperClass : Joose.I.FutureClass('MyApp.Util.Helper')
}
})
GROUPED LOADING MODE
====================
This framework can operate in special mode, in which it can load *any* class, with *any number* of dependencies (in-depth),
with **2** http requests.
For more information about this mode please refer to <http://www.extjs.com/forum/showthread.php?t=69161>
This item is currently in TODO list.
GETTING HELP
============
This extension is supported via github issues tracker: <http://github.com/SamuraiJack/JooseX-Namespace-Depended/issues>
For general Joose questions you can also visit #joose on irc.freenode.org or the forum at: <http://joose.it/forum>
SEE ALSO
========
[Authoring this framework][authoring]
Base resource class: [JooseX.Namespace.Depended.Resource](Depended/Resource.html)
Web page of this module: <http://github.com/SamuraiJack/JooseX-Namespace-Depended/>
General documentation for Joose: <http://openjsan.org/go/?l=Joose>
BUGS
====
All complex software has bugs lurking in it, and this module is no exception.
Please report any bugs through the web interface at <http://github.com/SamuraiJack/JooseX-Namespace-Depended/issues>
AUTHORS
=======
Nickolay Platonov <nplatonov@cpan.org>
COPYRIGHT AND LICENSE
=====================
Copyright (c) 2009, Nickolay Platonov
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[authoring]: Depended/Authoring.html
*/
;