├── .gitignore ├── artifacts ├── .empty ├── sslac-0.0.2.min.js └── sslac-0.0.2.js ├── src ├── copyright.js ├── licenses.js ├── licenses │ ├── sslac_mit.js │ └── yui_bsd.js └── sslac.js ├── Makefile ├── package.json ├── README.md ├── config └── smoosh.json ├── Makefile.js ├── README.orig.md └── tests └── sslac.test.js /.gitignore: -------------------------------------------------------------------------------- 1 | tmp/* -------------------------------------------------------------------------------- /artifacts/.empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/copyright.js: -------------------------------------------------------------------------------- 1 | /* 2 | Library: Sslac 3 | Homepage: https://github.com/jakobo/sslac 4 | License: MIT License 5 | */ 6 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: sslac cleantmp 2 | 3 | requires: smoosh qunit 4 | 5 | smoosh: 6 | npm install smoosh 7 | 8 | qunit: 9 | npm install qunit 10 | 11 | sslac: 12 | node Makefile.js 13 | 14 | cleantmp: 15 | rm -rf tmp 16 | 17 | clean: 18 | rm -rf artifacts/*.js -------------------------------------------------------------------------------- /src/licenses.js: -------------------------------------------------------------------------------- 1 | /* 2 | ADDITIONAL LICENSES USED IN THIS PACKAGE: 3 | Segments of this code are (c) specific individuals and groups, listed 4 | below with their licensing. Please see 5 | https://github.com/Jakobo/Sslac/tree/master/src/licenses or the bottom of 6 | this file for full copyrights and licenses. 7 | 8 | sslac.js contains: 9 | BSD Licensed code Copyright (c) 2010, Yahoo! Inc. 10 | 11 | */ -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Sslac", 3 | "description": "A slick way to do prototypical classes in JavaScript, even if it feels a bit backwards", 4 | "version": "0.0.2", 5 | "homepage": "https://github.com/jakobo/sslac/", 6 | "repository": { 7 | "type": "git", 8 | "url": "git://github.com/Jakobo/Sslac.git" 9 | }, 10 | "author": "Jakob Heuser ", 11 | "main": "./artifacts/sslac-0.0.2.min.js", 12 | "engines": { 13 | "node": ">= 0.4.1" 14 | }, 15 | "dependencies": { 16 | "smoosh": ">= 0.2.0", 17 | "qunit": ">= 0.1.5" 18 | } 19 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Sslac is now retired! 2 | ## But we have options for you :) 3 | 4 | Looking for an awesome class based library? Here's some options... 5 | 6 | * Fiber.js - https://github.com/linkedin/Fiber - the Fiber library is a great option when you're looking for performance. It's faster than Sslac, and smaller in file size. 7 | * JSFace - https://github.com/tnhu/jsface - the JSFace library is similar to Sslac in spirit, but works beyond just in browsers (also node.js friendly) and has support for polymorphic functions. If you're looking for classical OOP in JS, it's pretty hard to beat. 8 | 9 | Thanks to everyone who's been so supportive of the library. This will remain as a reference implementation. -------------------------------------------------------------------------------- /config/smoosh.json: -------------------------------------------------------------------------------- 1 | { 2 | "JSHINT_OPTS": { 3 | "asi": true, 4 | "bitwise": false, 5 | "boss": true, 6 | "curly": true, 7 | "debug": false, 8 | "devel": false, 9 | "eqeqeq": true, 10 | "evil": false, 11 | "forin": false, 12 | "immed": true, 13 | "indent": 2, 14 | "laxbreak": false, 15 | "maxerr": 50, 16 | "newcap": true, 17 | "noarg": false, 18 | "noempty": true, 19 | "nonew": true, 20 | "nomen": true, 21 | "onevar": false, 22 | "passfail": false, 23 | "plusplus": false, 24 | "regexp": false, 25 | "undef": true, 26 | "sub": true, 27 | "strict": false, 28 | "white": true 29 | }, 30 | "JAVASCRIPT": { 31 | "DIST_DIR": "tmp", 32 | "sslac": [ "./src/sslac.js" ] 33 | } 34 | } -------------------------------------------------------------------------------- /Makefile.js: -------------------------------------------------------------------------------- 1 | var VERSION = "0.0.2", 2 | smoosh = require("smoosh"), 3 | fs = require("fs"), 4 | qunit = require("qunit"); 5 | 6 | // qunit settings 7 | qunit.options.coverage = false; 8 | 9 | // test, yo 10 | qunit.run({ 11 | code: "./src/sslac.js", 12 | tests: "./tests/sslac.test.js" 13 | }); 14 | 15 | // smoosh, double yo 16 | smoosh.make("config/smoosh.json"); 17 | 18 | var copyright = fs.readFileSync("./src/copyright.js", "utf8"), 19 | sslac = fs.readFileSync("./tmp/sslac.js", "utf8"), 20 | sslacMin = fs.readFileSync("./tmp/sslac.min.js", "utf8") + ";", 21 | licenses = { 22 | "yui_bsd": fs.readFileSync("./src/licenses/yui_bsd.js", "utf8"), 23 | "sslac_mit": fs.readFileSync("./src/licenses/yui_bsd.js", "utf8"), 24 | "header": fs.readFileSync("./src/licenses.js", "utf8"), 25 | }; 26 | 27 | fs.writeFileSync("./artifacts/sslac-"+VERSION+".js", [ 28 | copyright, 29 | licenses.header, 30 | licenses.sslac_mit, 31 | sslac, 32 | licenses.yui_bsd 33 | ].join("\n"), "utf8"); 34 | 35 | fs.writeFileSync("./artifacts/sslac-"+VERSION+".min.js", [ 36 | copyright, 37 | sslacMin 38 | ].join(""), "utf8"); 39 | -------------------------------------------------------------------------------- /src/licenses/sslac_mit.js: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2008 Jakob Heuser 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ -------------------------------------------------------------------------------- /src/licenses/yui_bsd.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010, Yahoo! Inc. 3 | All rights reserved. 4 | Redistribution and use of this software in source and binary forms, with or 5 | without modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used 16 | to endorse or promote products derived from this software without specific prior 17 | written permission of Yahoo! Inc. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | -------------------------------------------------------------------------------- /artifacts/sslac-0.0.2.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | Library: Sslac 3 | Homepage: https://github.com/jakobo/sslac 4 | License: MIT License 5 | */ 6 | /*global module: true, ObjectRef: true */ 7 | (function(){function q(a,b){function o(){var b=this,f=null,j=null;this.Parents=[],this.Parent=function(){var a=this.Parents[this.Parents.length-1],d=this.Identifier(),e=g(d.ext)[h(d.ext)],f=c[a]?c[a]:e.prototype&&e.prototype[a]?e.prototype[a]:function(){};return f.apply(b,arguments)},i.Identifier=function(){return{name:a,ext:d}};for(f in i)i.hasOwnProperty(f)&&(this[f]=l(f,b));this.Parents.push("constructor"),j=e.apply(this,arguments),this.Parents.pop();for(f in i)i.hasOwnProperty(f)&&(this[f]=l(f,b));return j}function n(a,b){return function(){this.Parents.push(a);var c=b.apply(this,arguments);this.Parents.pop();return c}}function l(a,b){return function(){this.Parents.push(a);var c=i[a].apply(b,arguments);this.Parents.pop();return c}}var c=null,d="",e=function(){},i={},j=g(a),k={};this.Implements=function(){function b(a){return function(){throw new Error("The interface defined requires "+a)}}var a=this;for(var c=0,d=arguments.length;c=0?a.Implements(m(arguments[c])):this.getMethod(arguments[c])||this.Method(arguments[c],b(arguments[c]));return this},this.Constructor=function(a){e=a;return this},this.getConstructor=function(){return e},this.Method=function(a,b){o.prototype[a]=n(a,b);return this},this.getMethod=function(a){return o.prototype[a]},this.Static=function(a,b){o[a]=b,k[a]=b;return this},this.getStatic=function(a){return o[a]},this.Extends=function(a){var b=a;typeof a=="string"&&(b=g(a)[h(a)],d=a),f(o,b),c=o.superclass;return this},this.getExtends=function(){return c},this.Extends(p),b?j[h(a)]=k:j[h(a)]=o}function p(){this.Identifier=function(){return{name:"Sslac.ClassObject",ext:""}}}function o(){var c=d;a[b]=e;return c}function n(a){return c[a]}function m(a,b){return g(a,b)[h(a)]}function l(a){var b=g(a),c=h(a);b[c]=b[c]||{}}function k(a,b){var c=g(a),d=h(a);c[d]=b}function j(a){c[a]=new q(a,!0);return c[a]}function i(a){c[a]=new q(a);return c[a]}function h(a){var b=a.split(/\./),c=b[b.length-1];return c}function g(b,c){var d,e,f=c||a,g=b.split(/\./),h=g.length;for(d=0;d 18 | */ 19 | 20 | var globalWindow = this, 21 | NAMESPACE = "Sslac", 22 | SslacRegistry = {}, 23 | externalInterface = null, 24 | reFunction = /^function/, 25 | oldSslac = globalWindow[NAMESPACE], 26 | HAS_FUNCTION_RECAST_BUG = false/*@cc_on || ((ScriptEngineMajorVersion()+(ScriptEngineMinorVersion()/10)) <= 5.8)@*/; 27 | 28 | 29 | globalWindow[NAMESPACE] = globalWindow[NAMESPACE] || {}; 30 | externalInterface = globalWindow[NAMESPACE]; 31 | 32 | /** 33 | * extend an object and assign parent to .superclass 34 | * @license BSD 35 | * @author YUI 36 | * @private 37 | * @method extend 38 | * @param subc {Object} the subclass object 39 | * @param superc {Object} the superclass object 40 | * @param overrides {Object} any methods / properties to apply after extending 41 | */ 42 | function extend(subc, superc, overrides) { 43 | var F = function () {}; 44 | F.prototype = superc.prototype; 45 | subc.prototype = new F(); 46 | subc.prototype.constructor = subc; 47 | subc.superclass = superc.prototype; 48 | if (superc.prototype.constructor === Object.prototype.constructor) { 49 | superc.prototype.constructor = superc; 50 | } 51 | if (overrides) { 52 | for (var i in overrides) { 53 | if (overrides.hasOwnProperty(overrides, i)) { 54 | subc.prototype[i] = overrides[i]; 55 | } 56 | } 57 | } 58 | } 59 | 60 | /** 61 | * A simple isArray checker based on comparing the prototype in a predictable way 62 | * @method isArray 63 | * @private 64 | * @param arr {Array} an array to test 65 | * @return {Boolean} true if the arr is an array 66 | */ 67 | function isArray(arr) { 68 | return (Object.prototype.toString.call(arr).slice(8, -1).toLowerCase() === "array") ? true : false; 69 | } 70 | 71 | /** 72 | * A test to validate if a provided object is a callable function 73 | * functions can be upcast to Object if they go through window.opener. This makes sure 74 | * it's still a callable function 75 | * @method isCallableFunction 76 | * @private 77 | * @param fn {Function} an object to test 78 | * @return {Boolean} true if fn was a callable function 79 | */ 80 | function isCallableFunction(fn) { 81 | if (typeof fn === "function") { 82 | return true; 83 | } 84 | 85 | // IE specific (object, and looking at an object) 86 | if (HAS_FUNCTION_RECAST_BUG && typeof fn === "object" && typeof fn.call !== "undefined" && typeof fn.apply !== "undefined") { 87 | try { 88 | // we test against the internal toString(). When moved through window.opener, trying to use 89 | // Object.prototype will result in an unclassed object 90 | return reFunction.test(fn.toString()); 91 | } 92 | catch(e) { 93 | return false; // toString() failed. Was either overridden and broken or not implemented 94 | } 95 | } 96 | 97 | return false; 98 | } 99 | 100 | /** 101 | * @method namespaceOf 102 | * @private 103 | * @for Sslac 104 | * @see namespaceOf 105 | */ 106 | function namespaceOf(ns, root) { 107 | var i, 108 | piece, 109 | scope = root || globalWindow, 110 | pieces = ns.split(/\./), 111 | len = pieces.length; 112 | 113 | // loop through all pieces 114 | for (i = 0; i < len; i++) { 115 | piece = pieces[i]; 116 | 117 | // if not a match, drill down one further 118 | if (i + 1 === len) { 119 | return scope; 120 | } 121 | 122 | scope[piece] = scope[piece] || {}; 123 | scope = scope[piece]; 124 | } 125 | } 126 | 127 | /** 128 | * @method nameOf 129 | * @private 130 | * @for Sslac 131 | * @see nameOf 132 | */ 133 | function nameOf(ns) { 134 | var pieces = ns.split(/\./), 135 | last = pieces[pieces.length - 1]; 136 | return last; 137 | } 138 | 139 | /** 140 | * @method createObject 141 | * @private 142 | * @for Sslac 143 | * @see Class 144 | */ 145 | function createObject(ns) { 146 | SslacRegistry[ns] = new ObjectRef(ns); 147 | return SslacRegistry[ns]; 148 | } 149 | 150 | /** 151 | * @method createStatic 152 | * @private 153 | * @for Sslac 154 | * @see Class 155 | */ 156 | function createStatic(ns) { 157 | SslacRegistry[ns] = new ObjectRef(ns, true); 158 | return SslacRegistry[ns]; 159 | } 160 | 161 | /** 162 | * @method createStatic 163 | * @private 164 | * @for Sslac 165 | * @see Implements 166 | */ 167 | function createInterface(ns) { 168 | SslacRegistry[ns] = new InterfaceRef(ns); 169 | return SslacRegistry[ns]; 170 | } 171 | 172 | /** 173 | * @method createFunction 174 | * @private 175 | * @for Sslac 176 | * @see Function 177 | */ 178 | function createFunction(ns, fn) { 179 | var placeNS = namespaceOf(ns); 180 | var placeName = nameOf(ns); 181 | placeNS[placeName] = fn; 182 | } 183 | 184 | /** 185 | * @method defineNamespace 186 | * @private 187 | * @for Sslac 188 | * @see Define 189 | */ 190 | function defineNamespace(ns) { 191 | var placeNS = namespaceOf(ns); 192 | var placeName = nameOf(ns); 193 | placeNS[placeName] = placeNS[placeName] || {}; 194 | } 195 | 196 | /** 197 | * @method resolveNamespace 198 | * @private 199 | * @for Sslac 200 | * @see valueOf 201 | */ 202 | function resolveNamespace(ns, root) { 203 | return namespaceOf(ns, root)[nameOf(ns)]; 204 | } 205 | 206 | /** 207 | * @method getDefinition 208 | * @private 209 | * @for Sslac 210 | * @see definitionOf 211 | */ 212 | function getDefinition(ns) { 213 | return SslacRegistry[ns]; 214 | } 215 | 216 | /** 217 | * @method noConflict 218 | * @private 219 | * @for Sslac 220 | * @see noConflict 221 | */ 222 | function noConflict() { 223 | var thisSslac = externalInterface; 224 | globalWindow[NAMESPACE] = oldSslac; 225 | return thisSslac; 226 | } 227 | 228 | /** 229 | * The root object from which all others will inherit 230 | * @class Class 231 | * @for Sslac 232 | * @constructor 233 | */ 234 | function Class() { 235 | this.Identifier = function () { 236 | return { 237 | name: "Sslac.ClassObject", 238 | ext: "" 239 | }; 240 | }; 241 | } 242 | 243 | function InterfaceRef(ns) { 244 | var placeNS = namespaceOf(ns), 245 | placeName = nameOf(ns), 246 | thisModule = this, 247 | cache = {}; 248 | 249 | placeNS[placeName] = []; 250 | 251 | this.Method = function(name) { 252 | if (!cache[name]) { 253 | cache[name] = true; 254 | placeNS[placeName].push(name); 255 | } 256 | return this; 257 | }; 258 | 259 | this.Extends = function(extNs) { 260 | if (typeof extNs === "string") { 261 | extNs = resolveNamespace(extNs); 262 | } 263 | 264 | for (var i = 0, len = extNs.length; i < len; i++) { 265 | thisModule.Method(extNs[i]); 266 | } 267 | 268 | return this; 269 | }; 270 | 271 | // breaks the promise 272 | this.test = function(obj) { 273 | for (var i = 0, len = placeNS[placeName].length; i < len; i++) { 274 | var name = placeNS[placeName][i]; 275 | if (!isCallableFunction(obj[name])) { 276 | return false; 277 | } 278 | } 279 | return true; 280 | }; 281 | } 282 | 283 | /** 284 | * Root chaining object for Sslac. Takes a namespace and isStatic 285 | * this is the base object for construction of Sslac classes 286 | * @class ObjectRef 287 | * @consructor 288 | * @for Sslac 289 | */ 290 | function ObjectRef(ns, isStatic) { 291 | var parent = null, 292 | parentNS = "", 293 | localConstructor = function () { 294 | this.Parent.apply(this, arguments); 295 | }, 296 | privilegedMethods = {}, 297 | placeNS = namespaceOf(ns), 298 | staticObj = {}; 299 | 300 | /** 301 | * Builds privlieged methods 302 | * @for ObjectRef 303 | * @method buildMethod 304 | * @private 305 | * @param name {String} the name of the method 306 | * @param scope {Object} a scope for the method to run in 307 | * @return {Object} the return value from the named method 308 | */ 309 | function buildMethod(name, scope) { 310 | return function () { 311 | this.Parents.push(name); 312 | var retVal = privilegedMethods[name].apply(scope, arguments); 313 | this.Parents.pop(); 314 | return retVal; 315 | }; 316 | } 317 | 318 | /** 319 | * Builds prototype methods 320 | * @for ObjectRef 321 | * @method buildPrototype 322 | * @private 323 | * @param name {String} the name of the method 324 | * @param fn {Function} a function to run in ObjectRef's scope 325 | * @return {Object} the return value from the function 326 | */ 327 | function buildPrototype(name, fn) { 328 | return function () { 329 | this.Parents.push(name); 330 | var retVal = fn.apply(this, arguments); 331 | this.Parents.pop(); 332 | return retVal; 333 | }; 334 | } 335 | 336 | /** 337 | * The internally constructed object for ObjectRef 338 | * This is what the end user interfaces with 339 | * @class F 340 | * @for ObjectRef 341 | * @constructor 342 | */ 343 | function F() { 344 | var thisObj = this, 345 | name = null, 346 | retVal = null; 347 | 348 | this.Parents = []; 349 | 350 | /** 351 | * Invokes the parent method off the prototype chain 352 | * @method Parent 353 | * @param {Object} takes an overloaded number of arguments 354 | * @return {Object} the return value from the parent method 355 | */ 356 | this.Parent = function () { 357 | var name = this.Parents[this.Parents.length - 1], 358 | id = this.Identifier(), 359 | protoObj = namespaceOf(id.ext)[nameOf(id.ext)], 360 | fn = (parent[name]) ? parent[name] : 361 | (protoObj.prototype && protoObj.prototype[name]) ? protoObj.prototype[name] : function () {}; 362 | 363 | return fn.apply(thisObj, arguments); 364 | }; 365 | 366 | privilegedMethods.Identifier = function () { 367 | return { 368 | name: ns, 369 | ext: parentNS 370 | }; 371 | }; 372 | 373 | // set overridden methods 374 | for (name in privilegedMethods) { 375 | if (privilegedMethods.hasOwnProperty(name)) { 376 | this[name] = buildMethod(name, thisObj); 377 | } 378 | } 379 | 380 | this.Parents.push("constructor"); 381 | retVal = localConstructor.apply(this, arguments); 382 | this.Parents.pop(); 383 | 384 | // restore overridden methods 385 | for (name in privilegedMethods) { 386 | if (privilegedMethods.hasOwnProperty(name)) { 387 | this[name] = buildMethod(name, thisObj); 388 | } 389 | } 390 | 391 | return retVal; 392 | } 393 | 394 | /** 395 | * implements a collection of methods 396 | * @method Implements 397 | * @for F 398 | * @param {Array } the interface to implement 399 | * @return this 400 | */ 401 | this.Implements = function () { 402 | var thisModule = this; 403 | 404 | function createImplementsMethod(name) { 405 | return function () { 406 | throw new Error("The interface defined requires " + name); 407 | }; 408 | } 409 | 410 | for (var i = 0, len = arguments.length; i < len; i++) { 411 | if (isArray(arguments[i])) { 412 | for (var j = 0, j_len = arguments[i].length; j < j_len; j++) { 413 | thisModule.Implements(arguments[i][j]); 414 | } 415 | } 416 | else { 417 | // does it contain a "."? If so, this is a namespaced item to resolve 418 | if (arguments[i].indexOf(".") >= 0) { 419 | thisModule.Implements(resolveNamespace(arguments[i])); 420 | } 421 | else { 422 | if (!this.getMethod(arguments[i])) { 423 | this.Method(arguments[i], createImplementsMethod(arguments[i])); 424 | } 425 | } 426 | } 427 | } 428 | 429 | return this; 430 | }; 431 | 432 | /** 433 | * defines a constructor 434 | * @method Constructor 435 | * @for F 436 | * @param {Function} the function to set 437 | * @return this 438 | */ 439 | this.Constructor = function (fn) { 440 | localConstructor = fn; 441 | return this; 442 | }; 443 | 444 | /** 445 | * get the constructor that has been defined 446 | * @method getConstructor 447 | * @for F 448 | * @return {Function} 449 | */ 450 | this.getConstructor = function () { 451 | return localConstructor; 452 | }; 453 | 454 | /** 455 | * Explicitly put something on the prototype 456 | * @method Method 457 | * @for F 458 | * @param name {String} the name to store 459 | * @param fn {Function} the function to set 460 | * @return this 461 | */ 462 | this.Method = function (name, fn) { 463 | F.prototype[name] = buildPrototype(name, fn); 464 | return this; 465 | }; 466 | 467 | /** 468 | * Get a method from the prototype 469 | * @method getMethod 470 | * @for F 471 | * @param name {String} the method to get 472 | * @return {Function} 473 | */ 474 | this.getMethod = function (name) { 475 | return F.prototype[name]; 476 | }; 477 | 478 | /** 479 | * Explicitly put something on the static object 480 | * @method Static 481 | * @for F 482 | * @param name {String} the name to store 483 | * @param fn {Function} the function to set 484 | * @return this 485 | */ 486 | this.Static = function (name, fn) { 487 | F[name] = fn; 488 | staticObj[name] = fn; 489 | return this; 490 | }; 491 | 492 | /** 493 | * Get something from the static object 494 | * @method getStatic 495 | * @for F 496 | * @param name {String} the method to get 497 | * @return {Function} 498 | */ 499 | this.getStatic = function (name) { 500 | return F[name]; 501 | }; 502 | 503 | /** 504 | * define the superclass of this object 505 | * @method Extends 506 | * @for F 507 | * @param {String|Object} the object to extend 508 | * @return this 509 | */ 510 | this.Extends = function (name) { 511 | var obj = name; 512 | if (typeof name === "string") { 513 | obj = namespaceOf(name)[nameOf(name)]; 514 | parentNS = name; 515 | } 516 | extend(F, obj); 517 | parent = F.superclass; 518 | return this; 519 | }; 520 | 521 | /** 522 | * Get the object this object extends 523 | * @method getExtends 524 | * @for F 525 | * @return {Object} 526 | */ 527 | this.getExtends = function () { 528 | return parent; 529 | }; 530 | 531 | // extend default class 532 | this.Extends(Class); 533 | 534 | if (isStatic) { 535 | placeNS[nameOf(ns)] = staticObj; 536 | } 537 | else { 538 | placeNS[nameOf(ns)] = F; 539 | } 540 | } 541 | 542 | // assign outward 543 | 544 | // class object for comparisons 545 | externalInterface.ClassObject = Class; 546 | 547 | /** 548 | * Turns ObjectRef into F by instantiating the ObjectRef 549 | * @method Class 550 | * @for Sslac 551 | * @see createObject 552 | * @param ns {String} the namespace to store the new object into 553 | * @return {Object} the created object reference 554 | */ 555 | externalInterface.Class = createObject; 556 | 557 | /** 558 | * Turns ObjectRef into F by instantiating the ObjectRef 559 | * @method Static 560 | * @for Sslac 561 | * @see createStatic 562 | * @param ns {String} the namespace to store the new object into 563 | * @return {Object} the created object reference 564 | */ 565 | externalInterface.Static = createStatic; 566 | 567 | externalInterface.Interface = createInterface; 568 | 569 | /** 570 | * Creates a function 571 | * @method Function 572 | * @for Sslac 573 | * @see createFunction 574 | * @param ns {String} the namespace to store the function in 575 | * @param fn {Function} the function to store 576 | * @return {Object} the created object reference 577 | */ 578 | externalInterface.Function = createFunction; 579 | 580 | /** 581 | * Ensures a given namespace is defined 582 | * @method Define 583 | * @for Sslac 584 | * @see defineNamespace 585 | * @param ns {String} the namespace to define 586 | */ 587 | externalInterface.Define = defineNamespace; 588 | 589 | /** 590 | * get the namespace object of a given ns 591 | * @method namespaceOf 592 | * @for Sslac 593 | * @see namespaceOf 594 | * @param ns {String} namespace 595 | * @param root {Object} the root NS 596 | * @return {Object} the parent NS (for insertion) 597 | */ 598 | externalInterface.namespaceOf = namespaceOf; 599 | 600 | /** 601 | * Get the endpoint name of a namespace 602 | * for example: Foo.Bar.Baz => Baz 603 | * @method nameOf 604 | * @for Sslac 605 | * @see nameOf 606 | * @param ns {String} the namespace 607 | * @param {String} the endpoint name 608 | */ 609 | externalInterface.nameOf = nameOf; 610 | 611 | /** 612 | * Return the value at a given namespace within a provided root object 613 | * @method valueOf 614 | * @for Sslac 615 | * @see resolveNamespace 616 | * @param ns {String} the namespace to find 617 | * @param root {Object} the root namespace to check, for example, "window" 618 | */ 619 | externalInterface.valueOf = resolveNamespace; 620 | 621 | /** 622 | * Gets the definition object at a given namespace 623 | * @method definitionOf 624 | * @for Sslac 625 | * @see getDefinition 626 | * @param ns {String} the namespace to return 627 | * @return {Object} the value at ns 628 | */ 629 | externalInterface.definitionOf = getDefinition; 630 | 631 | /** 632 | * Allows multiple Sslac instances to coexist 633 | * @method noConflict 634 | * @for Sslac 635 | * @see noConflict 636 | * @return {Object} this Sslac object 637 | */ 638 | externalInterface.noConflict = noConflict; 639 | 640 | // Common JS Modules 1.1 Compliance 641 | if (typeof module !== 'undefined' && module.exports) { 642 | module.exports = externalInterface.noConflict(); 643 | } 644 | }()); 645 | -------------------------------------------------------------------------------- /artifacts/sslac-0.0.2.js: -------------------------------------------------------------------------------- 1 | /* 2 | Library: Sslac 3 | Homepage: https://github.com/jakobo/sslac 4 | License: MIT License 5 | */ 6 | 7 | /* 8 | ADDITIONAL LICENSES USED IN THIS PACKAGE: 9 | Segments of this code are (c) specific individuals and groups, listed 10 | below with their licensing. Please see 11 | https://github.com/Jakobo/Sslac/tree/master/src/licenses or the bottom of 12 | this file for full copyrights and licenses. 13 | 14 | sslac.js contains: 15 | BSD Licensed code Copyright (c) 2010, Yahoo! Inc. 16 | 17 | */ 18 | /* 19 | Copyright (c) 2010, Yahoo! Inc. 20 | All rights reserved. 21 | Redistribution and use of this software in source and binary forms, with or 22 | without modification, are permitted provided that the following conditions are 23 | met: 24 | 25 | * Redistributions of source code must retain the above copyright notice, this 26 | list of conditions and the following disclaimer. 27 | 28 | * Redistributions in binary form must reproduce the above copyright notice, 29 | this list of conditions and the following disclaimer in the documentation 30 | and/or other materials provided with the distribution. 31 | 32 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used 33 | to endorse or promote products derived from this software without specific prior 34 | written permission of Yahoo! Inc. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 37 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 38 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 39 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 40 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 41 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 42 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 43 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 45 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | */ 47 | 48 | /*global module: true, ObjectRef: true */ 49 | 50 | (function () { 51 | 52 | /** 53 | * Sslac - A "backwards" class library for JavaScript 54 | * Provides a consistent way to declare classes to ease 1st and 3rd 55 | * party development by using closures. 56 | * Features: 57 | * - auto extension: Objects can be set to extend by default, allowing for 58 | * easy inheritance of this.* properties as well as prototyped methods 59 | * - static and instance functionality: Can create both static and instance 60 | * level objects 61 | * - monkeypatching: objects can be modified on the fly to ease code upgrade paths 62 | * @class Sslac 63 | * @static 64 | * @author Jakob Heuser 65 | */ 66 | 67 | var globalWindow = this, 68 | NAMESPACE = "Sslac", 69 | SslacRegistry = {}, 70 | externalInterface = null, 71 | oldSslac = globalWindow[NAMESPACE]; 72 | 73 | globalWindow[NAMESPACE] = globalWindow[NAMESPACE] || {}; 74 | externalInterface = globalWindow[NAMESPACE]; 75 | 76 | /** 77 | * extend an object and assign parent to .superclass 78 | * @license BSD 79 | * @author YUI 80 | * @private 81 | * @method extend 82 | * @param subc {Object} the subclass object 83 | * @param superc {Object} the superclass object 84 | * @param overrides {Object} any methods / properties to apply after extending 85 | */ 86 | function extend(subc, superc, overrides) { 87 | var F = function () {}; 88 | F.prototype = superc.prototype; 89 | subc.prototype = new F(); 90 | subc.prototype.constructor = subc; 91 | subc.superclass = superc.prototype; 92 | if (superc.prototype.constructor === Object.prototype.constructor) { 93 | superc.prototype.constructor = superc; 94 | } 95 | if (overrides) { 96 | for (var i in overrides) { 97 | if (overrides.hasOwnProperty(overrides, i)) { 98 | subc.prototype[i] = overrides[i]; 99 | } 100 | } 101 | } 102 | } 103 | 104 | /** 105 | * @method namespaceOf 106 | * @private 107 | * @for Sslac 108 | * @see namespaceOf 109 | */ 110 | function namespaceOf(ns, root) { 111 | var i, 112 | piece, 113 | scope = root || globalWindow, 114 | pieces = ns.split(/\./), 115 | len = pieces.length; 116 | 117 | // loop through all pieces 118 | for (i = 0; i < len; i++) { 119 | piece = pieces[i]; 120 | 121 | // if not a match, drill down one further 122 | if (i + 1 === len) { 123 | return scope; 124 | } 125 | 126 | scope[piece] = scope[piece] || {}; 127 | scope = scope[piece]; 128 | } 129 | } 130 | 131 | /** 132 | * @method nameOf 133 | * @private 134 | * @for Sslac 135 | * @see nameOf 136 | */ 137 | function nameOf(ns) { 138 | var pieces = ns.split(/\./), 139 | last = pieces[pieces.length - 1]; 140 | return last; 141 | } 142 | 143 | /** 144 | * @method createObject 145 | * @private 146 | * @for Sslac 147 | * @see Class 148 | */ 149 | function createObject(ns) { 150 | SslacRegistry[ns] = new ObjectRef(ns); 151 | return SslacRegistry[ns]; 152 | } 153 | 154 | /** 155 | * @method createStatic 156 | * @private 157 | * @for Sslac 158 | * @see Class 159 | */ 160 | function createStatic(ns) { 161 | SslacRegistry[ns] = new ObjectRef(ns, true); 162 | return SslacRegistry[ns]; 163 | } 164 | 165 | /** 166 | * @method createFunction 167 | * @private 168 | * @for Sslac 169 | * @see Function 170 | */ 171 | function createFunction(ns, fn) { 172 | var placeNS = namespaceOf(ns); 173 | var placeName = nameOf(ns); 174 | placeNS[placeName] = fn; 175 | } 176 | 177 | /** 178 | * @method defineNamespace 179 | * @private 180 | * @for Sslac 181 | * @see Define 182 | */ 183 | function defineNamespace(ns) { 184 | var placeNS = namespaceOf(ns); 185 | var placeName = nameOf(ns); 186 | placeNS[placeName] = placeNS[placeName] || {}; 187 | } 188 | 189 | /** 190 | * @method resolveNamespace 191 | * @private 192 | * @for Sslac 193 | * @see valueOf 194 | */ 195 | function resolveNamespace(ns, root) { 196 | return namespaceOf(ns, root)[nameOf(ns)]; 197 | } 198 | 199 | /** 200 | * @method getDefinition 201 | * @private 202 | * @for Sslac 203 | * @see definitionOf 204 | */ 205 | function getDefinition(ns) { 206 | return SslacRegistry[ns]; 207 | } 208 | 209 | /** 210 | * @method noConflict 211 | * @private 212 | * @for Sslac 213 | * @see noConflict 214 | */ 215 | function noConflict() { 216 | var thisSslac = externalInterface; 217 | globalWindow[NAMESPACE] = oldSslac; 218 | return thisSslac; 219 | } 220 | 221 | /** 222 | * The root object from which all others will inherit 223 | * @class Class 224 | * @for Sslac 225 | * @constructor 226 | */ 227 | function Class() { 228 | this.Identifier = function () { 229 | return { 230 | name: "Sslac.ClassObject", 231 | ext: "" 232 | }; 233 | }; 234 | } 235 | 236 | /** 237 | * Root chaining object for Sslac. Takes a namespace and isStatic 238 | * this is the base object for construction of Sslac classes 239 | * @class ObjectRef 240 | * @consructor 241 | * @for Sslac 242 | */ 243 | function ObjectRef(ns, isStatic) { 244 | var parent = null, 245 | parentNS = "", 246 | localConstructor = function () {}, 247 | privilegedMethods = {}, 248 | placeNS = namespaceOf(ns), 249 | staticObj = {}; 250 | 251 | /** 252 | * Builds privlieged methods 253 | * @for ObjectRef 254 | * @method buildMethod 255 | * @private 256 | * @param name {String} the name of the method 257 | * @param scope {Object} a scope for the method to run in 258 | * @return {Object} the return value from the named method 259 | */ 260 | function buildMethod(name, scope) { 261 | return function () { 262 | this.Parents.push(name); 263 | var retVal = privilegedMethods[name].apply(scope, arguments); 264 | this.Parents.pop(); 265 | return retVal; 266 | }; 267 | } 268 | 269 | /** 270 | * Builds prototype methods 271 | * @for ObjectRef 272 | * @method buildPrototype 273 | * @private 274 | * @param name {String} the name of the method 275 | * @param fn {Function} a function to run in ObjectRef's scope 276 | * @return {Object} the return value from the function 277 | */ 278 | function buildPrototype(name, fn) { 279 | return function () { 280 | this.Parents.push(name); 281 | var retVal = fn.apply(this, arguments); 282 | this.Parents.pop(); 283 | return retVal; 284 | }; 285 | } 286 | 287 | /** 288 | * The internally constructed object for ObjectRef 289 | * This is what the end user interfaces with 290 | * @class F 291 | * @for ObjectRef 292 | * @constructor 293 | */ 294 | function F() { 295 | var thisObj = this, 296 | name = null, 297 | retVal = null; 298 | 299 | this.Parents = []; 300 | 301 | /** 302 | * Invokes the parent method off the prototype chain 303 | * @method Parent 304 | * @param {Object} takes an overloaded number of arguments 305 | * @return {Object} the return value from the parent method 306 | */ 307 | this.Parent = function () { 308 | var name = this.Parents[this.Parents.length - 1], 309 | id = this.Identifier(), 310 | protoObj = namespaceOf(id.ext)[nameOf(id.ext)], 311 | fn = (parent[name]) ? parent[name] : 312 | (protoObj.prototype && protoObj.prototype[name]) ? protoObj.prototype[name] : function () {}; 313 | 314 | return fn.apply(thisObj, arguments); 315 | }; 316 | 317 | privilegedMethods.Identifier = function () { 318 | return { 319 | name: ns, 320 | ext: parentNS 321 | }; 322 | }; 323 | 324 | // set overridden methods 325 | for (name in privilegedMethods) { 326 | if (privilegedMethods.hasOwnProperty(name)) { 327 | this[name] = buildMethod(name, thisObj); 328 | } 329 | } 330 | 331 | this.Parents.push("constructor"); 332 | retVal = localConstructor.apply(this, arguments); 333 | this.Parents.pop(); 334 | 335 | // restore overridden methods 336 | for (name in privilegedMethods) { 337 | if (privilegedMethods.hasOwnProperty(name)) { 338 | this[name] = buildMethod(name, thisObj); 339 | } 340 | } 341 | 342 | return retVal; 343 | } 344 | 345 | /** 346 | * implements a collection of methods 347 | * @method Implements 348 | * @for F 349 | * @param {Array } the interface to implement 350 | * @return this 351 | */ 352 | this.Implements = function () { 353 | var thisModule = this; 354 | 355 | function createImplementsMethod(name) { 356 | return function () { 357 | throw new Error("The interface defined requires " + name); 358 | }; 359 | } 360 | 361 | for (var i = 0, len = arguments.length; i < len; i++) { 362 | // isArray 363 | if (Object.prototype.toString.call(arguments[i]).slice(8, -1).toLowerCase() === "array") { 364 | for (var j = 0, j_len = arguments[i].length; j < j_len; j++) { 365 | thisModule.Implements(arguments[i][j]); 366 | } 367 | } 368 | else { 369 | // does it contain a "."? If so, this is a namespaced item to resolve 370 | if (arguments[i].indexOf(".") >= 0) { 371 | thisModule.Implements(resolveNamespace(arguments[i])); 372 | } 373 | else { 374 | if (!this.getMethod(arguments[i])) { 375 | this.Method(arguments[i], createImplementsMethod(arguments[i])); 376 | } 377 | } 378 | } 379 | } 380 | 381 | return this; 382 | }; 383 | 384 | /** 385 | * defines a constructor 386 | * @method Constructor 387 | * @for F 388 | * @param {Function} the function to set 389 | * @return this 390 | */ 391 | this.Constructor = function (fn) { 392 | localConstructor = fn; 393 | return this; 394 | }; 395 | 396 | /** 397 | * get the constructor that has been defined 398 | * @method getConstructor 399 | * @for F 400 | * @return {Function} 401 | */ 402 | this.getConstructor = function () { 403 | return localConstructor; 404 | }; 405 | 406 | /** 407 | * Explicitly put something on the prototype 408 | * @method Method 409 | * @for F 410 | * @param name {String} the name to store 411 | * @param fn {Function} the function to set 412 | * @return this 413 | */ 414 | this.Method = function (name, fn) { 415 | F.prototype[name] = buildPrototype(name, fn); 416 | return this; 417 | }; 418 | 419 | /** 420 | * Get a method from the prototype 421 | * @method getMethod 422 | * @for F 423 | * @param name {String} the method to get 424 | * @return {Function} 425 | */ 426 | this.getMethod = function (name) { 427 | return F.prototype[name]; 428 | }; 429 | 430 | /** 431 | * Explicitly put something on the static object 432 | * @method Static 433 | * @for F 434 | * @param name {String} the name to store 435 | * @param fn {Function} the function to set 436 | * @return this 437 | */ 438 | this.Static = function (name, fn) { 439 | F[name] = fn; 440 | staticObj[name] = fn; 441 | return this; 442 | }; 443 | 444 | /** 445 | * Get something from the static object 446 | * @method getStatic 447 | * @for F 448 | * @param name {String} the method to get 449 | * @return {Function} 450 | */ 451 | this.getStatic = function (name) { 452 | return F[name]; 453 | }; 454 | 455 | /** 456 | * define the superclass of this object 457 | * @method Extends 458 | * @for F 459 | * @param {String|Object} the object to extend 460 | * @return this 461 | */ 462 | this.Extends = function (name) { 463 | var obj = name; 464 | if (typeof name === "string") { 465 | obj = namespaceOf(name)[nameOf(name)]; 466 | parentNS = name; 467 | } 468 | extend(F, obj); 469 | parent = F.superclass; 470 | return this; 471 | }; 472 | 473 | /** 474 | * Get the object this object extends 475 | * @method getExtends 476 | * @for F 477 | * @return {Object} 478 | */ 479 | this.getExtends = function () { 480 | return parent; 481 | }; 482 | 483 | // extend default class 484 | this.Extends(Class); 485 | 486 | if (isStatic) { 487 | placeNS[nameOf(ns)] = staticObj; 488 | } 489 | else { 490 | placeNS[nameOf(ns)] = F; 491 | } 492 | } 493 | 494 | // assign outward 495 | 496 | // class object for comparisons 497 | externalInterface.ClassObject = Class; 498 | 499 | /** 500 | * Turns ObjectRef into F by instantiating the ObjectRef 501 | * @method Class 502 | * @for Sslac 503 | * @see createObject 504 | * @param ns {String} the namespace to store the new object into 505 | * @return {Object} the created object reference 506 | */ 507 | externalInterface.Class = createObject; 508 | 509 | /** 510 | * Turns ObjectRef into F by instantiating the ObjectRef 511 | * @method Static 512 | * @for Sslac 513 | * @see createStatic 514 | * @param ns {String} the namespace to store the new object into 515 | * @return {Object} the created object reference 516 | */ 517 | externalInterface.Static = createStatic; 518 | 519 | /** 520 | * Creates a function 521 | * @method Function 522 | * @for Sslac 523 | * @see createFunction 524 | * @param ns {String} the namespace to store the function in 525 | * @param fn {Function} the function to store 526 | * @return {Object} the created object reference 527 | */ 528 | externalInterface.Function = createFunction; 529 | 530 | /** 531 | * Ensures a given namespace is defined 532 | * @method Define 533 | * @for Sslac 534 | * @see defineNamespace 535 | * @param ns {String} the namespace to define 536 | */ 537 | externalInterface.Define = defineNamespace; 538 | 539 | /** 540 | * get the namespace object of a given ns 541 | * @method namespaceOf 542 | * @for Sslac 543 | * @see namespaceOf 544 | * @param ns {String} namespace 545 | * @param root {Object} the root NS 546 | * @return {Object} the parent NS (for insertion) 547 | */ 548 | externalInterface.namespaceOf = namespaceOf; 549 | 550 | /** 551 | * Get the endpoint name of a namespace 552 | * for example: Foo.Bar.Baz => Baz 553 | * @method nameOf 554 | * @for Sslac 555 | * @see nameOf 556 | * @param ns {String} the namespace 557 | * @param {String} the endpoint name 558 | */ 559 | externalInterface.nameOf = nameOf; 560 | 561 | /** 562 | * Return the value at a given namespace within a provided root object 563 | * @method valueOf 564 | * @for Sslac 565 | * @see resolveNamespace 566 | * @param ns {String} the namespace to find 567 | * @param root {Object} the root namespace to check, for example, "window" 568 | */ 569 | externalInterface.valueOf = resolveNamespace; 570 | 571 | /** 572 | * Gets the definition object at a given namespace 573 | * @method definitionOf 574 | * @for Sslac 575 | * @see getDefinition 576 | * @param ns {String} the namespace to return 577 | * @return {Object} the value at ns 578 | */ 579 | externalInterface.definitionOf = getDefinition; 580 | 581 | /** 582 | * Allows multiple Sslac instances to coexist 583 | * @method noConflict 584 | * @for Sslac 585 | * @see noConflict 586 | * @return {Object} this Sslac object 587 | */ 588 | externalInterface.noConflict = noConflict; 589 | 590 | // Common JS Modules 1.1 Compliance 591 | if (typeof module !== 'undefined' && module.exports) { 592 | module.exports = externalInterface.noConflict(); 593 | } 594 | }()); 595 | 596 | /* 597 | Copyright (c) 2010, Yahoo! Inc. 598 | All rights reserved. 599 | Redistribution and use of this software in source and binary forms, with or 600 | without modification, are permitted provided that the following conditions are 601 | met: 602 | 603 | * Redistributions of source code must retain the above copyright notice, this 604 | list of conditions and the following disclaimer. 605 | 606 | * Redistributions in binary form must reproduce the above copyright notice, 607 | this list of conditions and the following disclaimer in the documentation 608 | and/or other materials provided with the distribution. 609 | 610 | * Neither the name of Yahoo! Inc. nor the names of its contributors may be used 611 | to endorse or promote products derived from this software without specific prior 612 | written permission of Yahoo! Inc. 613 | 614 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 615 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 616 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 617 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 618 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 619 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 620 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 621 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 622 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 623 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 624 | */ 625 | --------------------------------------------------------------------------------