Class Index | File Index

## Classes

- _global_
- Array
- Function
- pockets
- pockets.managers
- pockets.managers.EventManager
- pockets.managers.EventRegistration
- pockets.managers.EventTargetRegistration
- pockets.managers.MenuManager

# Built-In Namespace Function

Method Summary
Method Attributes | Method Name and Description
--- | ---
| inheritsFrom(parentClass) Sets the parent/child relationship between classes for applications that choose not to use Prototype.js's Class.create() to define classes.
| inject(fieldName) When using Pockets' Injection Context, gives a class access to a property of the injection context as if it were a property on the current class.
| injectionContext(contextFn) Returns a Pockets application 'injection context', an object that is used in lieu of polluting the global namespace.
| setInjectable(fieldName, value) When using a Pockets injection context for 'app-global' data, you must use this setter function in order to set the value of the injected property.

Method Detail
inheritsFrom(parentClass)
Sets the parent/child relationship between classes for applications that choose not to use Prototype.js's Class.create() to define classes. Used after you declare the child class's constructor like this: in foo.js: function Foo() { this.baz = 'quux';} in bar.js: function Bar() { this.baz = 'corge';} Bar.inheritsFrom(Foo);
Defined in: pockets.js.

Parameters:
parentClass

inject(fieldName)
When using Pockets' Injection Context, gives a class access to a property of the injection context as if it were a property on the current class.
Defined in: pockets.js.

    function Foo() { }
    Foo.inject('bar');

    Foo.prototype.someFunc = function() {
      ...
      console.log(this.bar); // returns bar from the Injection Context
      ...
    }

Parameters:
fieldName

injectionContext(contextFn)
Returns a Pockets application 'injection context', an object that is used in lieu of polluting the global namespace. Applications need "global" data - specifically, your Mojo Scene Assistants will want/need to get access to top-level/app-wide data. Pockets offers a way to make this data available via the technique of the injecttion context. The app defines the location of this data once, and then other classes can declare they want access to it with #inject method. The complicated, less common case is that you need to use something other than your AppAssistant to store your injectables. If this applies, then let Pockets know about your context by calling Function#injectionContext with a function that returns this object. You can then use Function#inject and Function#setInjectible to declare access to properties & set properties respectively.
Defined in: pockets.js.

     // Simple example definition

     // Delcare in your AppAssistant
     function AppAssistant() {
       ...
       this.injectionContext = {
         foo: 1,
         bar: 2
       };
       ...
      }

     // Complex definition (noted contrived example)

     var myGlobals() {
       this.foo = 1;
       this.bar = 2;
     }

     maybeStageAssistant.injectionContext(function() {return myGlobals;}

      // How to use your injection context
      function Foo() {}
      Foo.inject('bar');

      Foo.prototype.someFunc = function() {
        ...
        var globalVar = this.bar;       // get the 'global' value
        this.setInjectible('bar', 17);  // set the 'global' value
        ...

Parameters:
contextFn

See:
  Function#inject, Function#setInjectable

setInjectable(fieldName, value)
When using a Pockets injection context for 'app-global' data, you must use this setter function in order to set the value of the injected property.
Defined in: pockets.js.

    function Foo() { }
    Foo.inject('bar');

    Foo.prototype.anotherFunc = function() {
      ...
      this.bar = 'baz'; // FAIL
      ...
      this.setInjectable('bar', 'baz'); // correctly set the injected property
      ...
    }

Parameters:
fieldName
  property of the injection context to set
value
  new value

Documentation generated by JsDoc Toolkit 2.3.0 on Sat Jun 27 2009 08:38:33 GMT-0700 (PDT)