Permalink
Browse files

updated to 0.0.2 with Implements

  • Loading branch information...
Jakobo committed Apr 26, 2011
1 parent bd9c6e4 commit 30b084c85387a236d77d383521af8384ae55b314
Showing with 103 additions and 92 deletions.
  1. +103 −92 src/sslac.js
View
@@ -1,4 +1,4 @@
-/*global module: true */
+/*global module: true, ObjectRef: true */
(function () {
@@ -92,6 +92,73 @@
last = pieces[pieces.length - 1];
return last;
}
+
+ /**
+ * @method createObject
+ * @private
+ * @for Sslac
+ * @see Class
+ */
+ function createObject(ns) {
+ SslacRegistry[ns] = new ObjectRef(ns);
+ return SslacRegistry[ns];
+ }
+
+ /**
+ * @method createFunction
+ * @private
+ * @for Sslac
+ * @see Function
+ */
+ function createFunction(ns, fn) {
+ var placeNS = namespaceOf(ns);
+ var placeName = nameOf(ns);
+ placeNS[placeName] = fn;
+ }
+
+ /**
+ * @method defineNamespace
+ * @private
+ * @for Sslac
+ * @see Define
+ */
+ function defineNamespace(ns) {
+ var placeNS = namespaceOf(ns);
+ var placeName = nameOf(ns);
+ placeNS[placeName] = placeNS[placeName] || {};
+ }
+
+ /**
+ * @method resolveNamespace
+ * @private
+ * @for Sslac
+ * @see valueOf
+ */
+ function resolveNamespace(ns, root) {
+ return namespaceOf(ns, root)[nameOf(ns)];
+ }
+
+ /**
+ * @method getDefinition
+ * @private
+ * @for Sslac
+ * @see definitionOf
+ */
+ function getDefinition(ns) {
+ return SslacRegistry[ns];
+ }
+
+ /**
+ * @method noConflict
+ * @private
+ * @for Sslac
+ * @see noConflict
+ */
+ function noConflict() {
+ var thisSslac = externalInterface;
+ globalWindow[NAMESPACE] = oldSslac;
+ return thisSslac;
+ }
/**
* The root object from which all others will inherit
@@ -215,6 +282,41 @@
return retVal;
}
+
+ /**
+ * implements a collection of methods
+ * @method Implements
+ * @for F
+ * @param {Array <String>} the interface to implement
+ * @return this
+ */
+ this.Implements = function () {
+ var thisModule = this;
+
+ function implementsMethod() {}
+
+ for (var i = 0, len = arguments.length; i < len; i++) {
+ // isArray
+ if (globalWindow.Function.toString.call(arguments[i]).slice(8, -1).toLowerCase() === "array") {
+ for (var j = 0, j_len = arguments[i].length; j < j_len; j++) {
+ thisModule.Implements(arguments[i][j]);
+ }
+ }
+ else {
+ // does it contain a "."? If so, this is a namespaced item to resolve
+ if (arguments[i].indexOf(".") >= 0) {
+ thisModule.Implements(resolveNamespace(arguments[i]));
+ }
+ else {
+ if (!this.getMethod(arguments[i])) {
+ this.Method(arguments[i], implementsMethod);
+ }
+ }
+ }
+ }
+
+ return this;
+ };
/**
* defines a constructor
@@ -238,30 +340,6 @@
return localConstructor;
};
- /**
- * defines a method (this.* syntax)
- * @method Final
- * @for F
- * @param name {String} the name to store
- * @param fn {Function} the function to set
- * @return this
- */
- this.Final = function (name, fn) {
- privilegedMethods[name] = fn;
- return this;
- };
-
- /**
- * get a final defined method (this.* syntax)
- * @method getFinal
- * @for F
- * @param name {String} the name of the method to get
- * @return {Function}
- */
- this.getFinal = function (name) {
- return privilegedMethods[name];
- };
-
/**
* Explicitly put something on the prototype
* @method Method
@@ -344,73 +422,6 @@
placeNS[nameOf(ns)] = F;
}
- /**
- * @method createObject
- * @private
- * @for Sslac
- * @see Class
- */
- function createObject(ns) {
- SslacRegistry[ns] = new ObjectRef(ns);
- return SslacRegistry[ns];
- }
-
- /**
- * @method createFunction
- * @private
- * @for Sslac
- * @see Function
- */
- function createFunction(ns, fn) {
- var placeNS = namespaceOf(ns);
- var placeName = nameOf(ns);
- placeNS[placeName] = fn;
- }
-
- /**
- * @method defineNamespace
- * @private
- * @for Sslac
- * @see Define
- */
- function defineNamespace(ns) {
- var placeNS = namespaceOf(ns);
- var placeName = nameOf(ns);
- placeNS[placeName] = placeNS[placeName] || {};
- }
-
- /**
- * @method resolveNamespace
- * @private
- * @for Sslac
- * @see valueOf
- */
- function resolveNamespace(ns, root) {
- return namespaceOf(ns, root)[nameOf(ns)];
- }
-
- /**
- * @method getDefinition
- * @private
- * @for Sslac
- * @see definitionOf
- */
- function getDefinition(ns) {
- return SslacRegistry[ns];
- }
-
- /**
- * @method noConflict
- * @private
- * @for Sslac
- * @see noConflict
- */
- function noConflict() {
- var thisSslac = externalInterface;
- globalWindow[NAMESPACE] = oldSslac;
- return thisSslac;
- }
-
// assign outward
// class object for comparisons

0 comments on commit 30b084c

Please sign in to comment.