/* vim: ts=2 sw=2 expandtab
 * BEGIN FLOCK GPL
 *
 * Copyright Flock Inc. 2005-2009
 * http://flock.com
 *
 * This file may be used under the terms of the
 * GNU General Public License Version 2 or later (the "GPL"),
 * http://www.gnu.org/licenses/gpl.html
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * END FLOCK GPL
 */

#include "nsISupports.idl"
#include "nsIRDFDataSource.idl"
#include "nsIRDFNode.idl"
#include "nsIRDFResource.idl"


/**
 * A mechanism to support the "singleton" metaphor for loading of JavaScript
 * chrome contexts.  If you've got a JS chrome file that should only be loaded
 * once but accessed from multiple locations (including inside XPCOM services),
 * then use this instead of calling eg. loadSubScript.
 *
 * To invoke:
 * Components.classes["@flock.com/singleton;1"]
 *   .getService(Components.interfaces.flockISingleton)
 *   .getSingleton(aURI).wrappedJSObject;
 *
 * @see mozIJSSubScriptLoader#loadSubScript
 */
[scriptable, uuid(965622a9-db19-432a-91a3-f1cdbe597673)]
interface flockISingleton : nsISupports {
  /**
   * @param aURI (in) URI (eg. chrome://...) of a JS script that should only be
   *        loaded once.
   * @return nsISupports object on which the caller can refer to
   *         .wrappedJSObject to access the JS context of the script.
   */
  nsISupports getSingleton(in AString aURI);
};
