Warning: Use of undefined constant Symbol - assumed 'Symbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215 Warning: Use of undefined constant JavaScriptSymbol - assumed 'JavaScriptSymbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215

dojo/Stateful.js

  • Provides:

    • dojo.Stateful
  • dojo.Stateful

    • type
      Function
    • parameters:
      • mixin
    • summary
      Base class for objects that provide named properties with optional getter/setter
      control and the ability to watch for property changes
    • example
      	var obj = new dojo.Stateful();
      	obj.watch("foo", function(){
      		console.log("foo changed to " + this.get("foo"));
      	});
      	obj.set("foo","bar");
  • dojo.Stateful.postscript

    • constructor - postscript
    • type
      Function
    • parameters:
      • mixin
  • dojo.Stateful.get

    • parameters:
      • name: (typeof String)
        The property to get.
    • summary
      Get a property on a Stateful instance.
    • description
      Get a named property on a Stateful object. The property may
      potentially be retrieved via a getter method in subclasses. In the base class
      this just retrieves the object's property.
      For example:
      	stateful = new dojo.Stateful({foo: 3});
      	stateful.get("foo") // returns 3
      	stateful.foo // returns 3
    • type
      Function
  • dojo.Stateful.set

    • parameters:
      • name: (typeof String)
        The property to set.
      • value: (typeof Object)
        The value to set in the property.
    • summary
      Set a property on a Stateful instance
    • description
      Sets named properties on a stateful object and notifies any watchers of
      the property. A programmatic setter may be defined in subclasses.
      For example:
      	stateful = new dojo.Stateful();
      	stateful.watch(function(name, oldValue, value){
      		// this will be called on the set below
      	}
      	stateful.set(foo, 5);
      
      set() may also be called with a hash of name/value pairs, ex:
      	myObj.set({
      		foo: "Howdy",
      		bar: 3
      	})
      This is equivalent to calling set(foo, "Howdy") and set(bar, 3)
    • type
      Function
  • dojo.Stateful.watch

    • parameters:
      • name: (typeof String)
        Indicates the property to watch. This is optional (the callback may be the
        only parameter), and if omitted, all the properties will be watched
      • callback: (typeof Function)
        The function to execute when the property changes. This will be called after
        the property has been changed. The callback will be called with the |this|
        set to the instance, the first argument as the name of the property, the
        second argument as the old value and the third argument as the new value.
    • summary
      Watches a property for changes
    • return_summary
      An object handle for the watch. The unwatch method of this object
      can be used to discontinue watching this property:
      	var watchHandle = obj.watch("foo", callback);
      	watchHandle.unwatch(); // callback won't be called now
    • type
      Function
  • dojo.Stateful._watchCallbacks

    • parameters:
      • name
      • oldValue
      • value
      • ignoreCatchall
    • type
      Function
  • dojo

    • type
      Object