Skip to content

Commit

Permalink
dojox/[r-v]*: api doc formatting fixes, refs #13101 !strict.
Browse files Browse the repository at this point in the history
  • Loading branch information
wkeese committed Jun 25, 2012
1 parent c30eedf commit 346921f
Show file tree
Hide file tree
Showing 31 changed files with 257 additions and 234 deletions.
21 changes: 10 additions & 11 deletions rpc/JsonRest.js
Expand Up @@ -281,13 +281,13 @@ define("dojox/rpc/JsonRest", ["dojo", "dojox", "dojox/json/ref", "dojox/rpc/Rest
deleteObject: function(object){
// summary:
// deletes an object
// object:
// object to delete
// object:
// object to delete
this.changing(object,true);
},
getConstructor: function(/*Function|String*/service, schema){
// summary:
// Creates or gets a constructor for objects from this service
// Creates or gets a constructor for objects from this service
if(typeof service == 'string'){
var servicePath = service;
service = new dojox.rpc.Rest(service,true);
Expand All @@ -299,8 +299,7 @@ define("dojox/rpc/JsonRest", ["dojo", "dojox", "dojox/json/ref", "dojox/rpc/Rest
service._constructor = function(data){
// summary:
// creates a new object for this table
//
// data:
// data:
// object to mixed in
var self = this;
var args = arguments;
Expand Down Expand Up @@ -363,8 +362,8 @@ define("dojox/rpc/JsonRest", ["dojo", "dojox", "dojox/json/ref", "dojox/rpc/Rest
getServiceAndId: function(/*String*/absoluteId){
// summary:
// Returns the REST service and the local id for the given absolute id. The result
// is returned as an object with a service property and an id property
// absoluteId:
// is returned as an object with a service property and an id property
// absoluteId:
// This is the absolute id of the object
var serviceName = '';

Expand All @@ -382,13 +381,13 @@ define("dojox/rpc/JsonRest", ["dojo", "dojox", "dojox/json/ref", "dojox/rpc/Rest
services:{},
schemas:{},
registerService: function(/*Function*/ service, /*String*/ servicePath, /*Object?*/ schema){
// summary:
// summary:
// Registers a service for as a JsonRest service, mapping it to a path and schema
// service:
// service:
// This is the service to register
// servicePath:
// servicePath:
// This is the path that is used for all the ids for the objects returned by service
// schema:
// schema:
// This is a JSON Schema object to associate with objects returned by this service
servicePath = service.servicePath = servicePath || service.servicePath;
service._schema = jr.schemas[servicePath] = schema || service._schema || {};
Expand Down
14 changes: 8 additions & 6 deletions rpc/OfflineRest.js
@@ -1,7 +1,5 @@
define("dojox/rpc/OfflineRest", ["dojo", "dojox", "dojox/data/ClientFilter", "dojox/rpc/Rest", "dojox/storage"], function(dojo, dojox) {
// summary:
// Makes the REST service be able to store changes in local
// storage so it can be used offline automatically.

var Rest = dojox.rpc.Rest;
var namespace = "dojox_rpc_OfflineRest";
var loaded;
Expand Down Expand Up @@ -53,6 +51,10 @@ define("dojox/rpc/OfflineRest", ["dojo", "dojox", "dojox/data/ClientFilter", "do
var syncId = setInterval(sync,15000);
dojo.connect(document, "ononline", sync);
OfflineRest = dojox.rpc.OfflineRest = {
// summary:
// Makes the REST service be able to store changes in local
// storage so it can be used offline automatically.

turnOffAutoSync: function(){
clearInterval(syncId);
},
Expand All @@ -64,9 +66,9 @@ define("dojox/rpc/OfflineRest", ["dojo", "dojox", "dojox/data/ClientFilter", "do
addStore: function(/*data-store*/store,/*query?*/baseQuery){
// summary:
// Adds a store to the monitored store for local storage
// store:
// store:
// Store to add
// baseQuery:
// baseQuery:
// This is the base query to should be used to load the items for
// the store. Generally you want to load all the items that should be
// available when offline.
Expand Down Expand Up @@ -252,5 +254,5 @@ define("dojox/rpc/OfflineRest", ["dojo", "dojox", "dojox/data/ClientFilter", "do
dojo.connect(index,"onLoad",saveObject);
dojo.connect(index,"onUpdate",saveObject);

return dojox.rpc.OfflineRest;
return OfflineRest;
});
42 changes: 20 additions & 22 deletions rpc/Rest.js
Expand Up @@ -2,24 +2,6 @@ define("dojox/rpc/Rest", ["dojo", "dojox"], function(dojo, dojox) {
// Note: This doesn't require dojox.rpc.Service, and if you want it you must require it
// yourself, and you must load it prior to dojox.rpc.Rest.

// summary:
// This provides a HTTP REST service with full range REST verbs include PUT,POST, and DELETE.
// description:
// A normal GET query is done by using the service directly:
// | var restService = dojox.rpc.Rest("Project");
// | restService("4");
// This will do a GET for the URL "/Project/4".
// | restService.put("4","new content");
// This will do a PUT to the URL "/Project/4" with the content of "new content".
// You can also use the SMD service to generate a REST service:
// | var services = dojox.rpc.Service({services: {myRestService: {transport: "REST",...
// | services.myRestService("parameters");
//
// The modifying methods can be called as sub-methods of the rest service method like:
// | services.myRestService.put("parameters","data to put in resource");
// | services.myRestService.post("parameters","data to post to the resource");
// | services.myRestService['delete']("parameters");

dojo.getObject("rpc.Rest", true, dojox);

if(dojox.rpc && dojox.rpc.transportRegistry){
Expand Down Expand Up @@ -64,7 +46,23 @@ define("dojox/rpc/Rest", ["dojo", "dojox"], function(dojo, dojox) {
}
drr = dojox.rpc.Rest = function(/*String*/path, /*Boolean?*/isJson, /*Object?*/schema, /*Function?*/getRequest){
// summary:
// Creates a REST service using the provided path.
// This provides a HTTP REST service with full range REST verbs include PUT,POST, and DELETE.
// description:
// A normal GET query is done by using the service directly:
// | var restService = dojox.rpc.Rest("Project");
// | restService("4");
// This will do a GET for the URL "/Project/4".
// | restService.put("4","new content");
// This will do a PUT to the URL "/Project/4" with the content of "new content".
// You can also use the SMD service to generate a REST service:
// | var services = dojox.rpc.Service({services: {myRestService: {transport: "REST",...
// | services.myRestService("parameters");
//
// The modifying methods can be called as sub-methods of the rest service method like:
// | services.myRestService.put("parameters","data to put in resource");
// | services.myRestService.post("parameters","data to post to the resource");
// | services.myRestService['delete']("parameters");

var service;
// it should be in the form /Table/
service = function(id, args){
Expand All @@ -74,8 +72,8 @@ define("dojox/rpc/Rest", ["dojo", "dojox"], function(dojo, dojox) {
service._schema = schema;
// cache:
// This is an object that provides indexing service
// This can be overriden to take advantage of more complex referencing/indexing
// schemes
// This can be overriden to take advantage of more complex referencing/indexing
// schemes
service.cache = {
serialize: isJson ? ((dojox.json && dojox.json.ref) || dojo).toJson : function(result){
return result;
Expand Down Expand Up @@ -142,5 +140,5 @@ define("dojox/rpc/Rest", ["dojo", "dojox"], function(dojo, dojox) {
return index(dojo.xhrGet(service._getRequest(id, args)), service, (args.start >= 0 || args.count >= 0), id);
};

return dojox.rpc.Rest;
return drr;
});
13 changes: 6 additions & 7 deletions rpc/Service.js
Expand Up @@ -5,8 +5,11 @@ dojo.declare("dojox.rpc.Service", null, {
// summary:
// Take a string as a url to retrieve an smd or an object that is an smd or partial smd to use
// as a definition for the service
//
// smd: object
// description:
// dojox.rpc.Service must be loaded prior to any plugin services like dojox.rpc.Rest
// dojox.rpc.JsonRpc in order for them to register themselves, otherwise you get
// a "No match found" error.
// smd: object
// Takes a number of properties as kwArgs for defining the service. It also
// accepts a string. When passed a string, it is treated as a url from
// which it should synchronously retrieve an smd file. Otherwise it is a kwArgs
Expand All @@ -16,11 +19,7 @@ dojo.declare("dojox.rpc.Service", null, {
// matches those defined in the smd. smdString allows a developer to pass
// a jsonString directly, which will be converted into an object or alternatively
// smdObject is accepts an smdObject directly.
//
// description:
// dojox.rpc.Service must be loaded prior to any plugin services like dojox.rpc.Rest
// dojox.rpc.JsonRpc in order for them to register themselves, otherwise you get
// a "No match found" error.

var url;
var self = this;
function processSmd(smd){
Expand Down
22 changes: 11 additions & 11 deletions rpc/tests/stores/JsonRestStore.js
Expand Up @@ -5,7 +5,7 @@ dojo.require("dojo.data.api.Read");
dojo.require("dojox.rpc.Service");

dojox.rpc.tests.stores.JsonRestStore.error = function(t, d, errData){
// summary:
// summary:
// The error callback function to be used for all of the tests.
d.errback(errData);
}
Expand All @@ -18,7 +18,7 @@ doh.register("dojox.rpc.tests.stores.JsonRestStore",
name: "Fetch some items",
timeout: 10000, //10 seconds.
runTest: function(t) {
// summary:
// summary:
// Simple test of a basic fetch on JsonRestStore of a simple query.
var d = new doh.Deferred();
jsonStore.fetch({query:"query",
Expand All @@ -34,7 +34,7 @@ doh.register("dojox.rpc.tests.stores.JsonRestStore",
name: "fetch by id",
timeout: 10000, //10 seconds.
runTest: function(t) {
// summary:
// summary:
// Simple test of a basic fetch on JsonRestStore of a single item.
var d = new doh.Deferred();
jsonStore.fetch({query:"obj1",
Expand All @@ -53,7 +53,7 @@ doh.register("dojox.rpc.tests.stores.JsonRestStore",
name: "Modify,save, check by id",
timeout: 10000, //10 seconds.
runTest: function(t) {
// summary:
// summary:
// Fetch an item from a query, modify and save it, and check to see if it was modified correctly
var d = new doh.Deferred();
jsonStore.fetch({query:"query",
Expand Down Expand Up @@ -82,7 +82,7 @@ doh.register("dojox.rpc.tests.stores.JsonRestStore",
name: "Post, delete, and put",
timeout: 10000, //10 seconds.
runTest: function(t) {
// summary:
// summary:
// append/post an item, delete it, sort the lists, resort the list, saving each time.
var d = new doh.Deferred();
jsonStore.fetch({query:"obj1",
Expand All @@ -108,7 +108,7 @@ doh.register("dojox.rpc.tests.stores.JsonRestStore",
name: "Revert",
timeout: 10000, //10 seconds.
runTest: function(t) {
// summary:
// summary:
// append/post an item, delete it, sort the lists, resort the list, saving each time.
var d = new doh.Deferred();
jsonStore.fetch({query:"obj1",
Expand All @@ -133,7 +133,7 @@ doh.register("dojox.rpc.tests.stores.JsonRestStore",
name: "Lazy loading",
timeout: 10000, //10 seconds.
runTest: function(t) {
// summary:
// summary:
// test lazy loading
var d = new doh.Deferred();
jsonStore.fetch({query:"query",
Expand All @@ -153,7 +153,7 @@ doh.register("dojox.rpc.tests.stores.JsonRestStore",
name: "Array manipulation",
timeout: 10000, //10 seconds.
runTest: function(t) {
// summary:
// summary:
// test array manipulation
var d = new doh.Deferred();
jsonStore.fetch({query:"obj1",
Expand All @@ -177,7 +177,7 @@ doh.register("dojox.rpc.tests.stores.JsonRestStore",
name: "ReadAPI: Fetch_20_Streaming",
timeout: 10000, //10 seconds. Json can sometimes be slow.
runTest: function(t) {
// summary:
// summary:
// fetching with paging

var d = new doh.Deferred();
Expand Down Expand Up @@ -206,9 +206,9 @@ doh.register("dojox.rpc.tests.stores.JsonRestStore",
}
},
function testReadAPI_functionConformance(t){
// summary:
// summary:
// Simple test read API conformance. Checks to see all declared functions are actual functions on the instances.
// description:
// description:
// Simple test read API conformance. Checks to see all declared functions are actual functions on the instances.

var readApi = new dojo.data.api.Read();
Expand Down
14 changes: 7 additions & 7 deletions secure/capability.js
Expand Up @@ -8,21 +8,21 @@ dojox.secure.capability = {
"throw", "true", "try", "typeof", "var", "void", "while"],
validate : function(/*string*/script,/*Array*/safeLibraries,/*Object*/safeGlobals) {
// summary:
// pass in the text of a script. If it passes and it can be eval'ed, it should be safe.
// Note that this does not do full syntax checking, it relies on eval to reject invalid scripts.
// There are also known false rejections:
// Nesting vars inside blocks will not declare the variable for the outer block
// pass in the text of a script. If it passes and it can be eval'ed, it should be safe.
// Note that this does not do full syntax checking, it relies on eval to reject invalid scripts.
// There are also known false rejections:
// Nesting vars inside blocks will not declare the variable for the outer block
// Named functions are not treated as declaration so they are generally not allowed unless the name is declared with a var.
// Var declaration that involve multiple comma delimited variable assignments are not accepted
//
// script:
// the script to execute
// the script to execute
//
// safeLibraries:
// The safe libraries that can be called (the functions can not be access/modified by the untrusted code, only called)
// The safe libraries that can be called (the functions can not be access/modified by the untrusted code, only called)
//
// safeGlobals:
// These globals can be freely interacted with by the untrusted code
// These globals can be freely interacted with by the untrusted code


var keywords = this.keywords;
Expand Down
18 changes: 9 additions & 9 deletions secure/fromJson.js
Expand Up @@ -7,9 +7,9 @@ dojo.provide("dojox.secure.fromJson");


dojox.secure.fromJson = typeof JSON != "undefined" ? JSON.parse :
// summary:
// summary:
// Parses a string of well-formed JSON text.
// description:
// description:
// Parses a string of well-formed JSON text. If the input is not well-formed,
// then behavior is undefined, but it is
// deterministic and is guaranteed not to modify any object other than its
Expand All @@ -28,19 +28,19 @@ dojox.secure.fromJson = typeof JSON != "undefined" ? JSON.parse :
// looks like JSON, but that executes arbitrary javascript.
//
// To configure dojox.secure.fromJson as the JSON parser for all Dojo
// JSON parsing, simply do:
// JSON parsing, simply do:
// | dojo.require("dojox.secure.fromJson");
// | dojo.fromJson = dojox.secure.fromJson;
// or alternately you could configure dojox.secure.fromJson to only handle
// XHR responses:
// XHR responses:
// | dojo._contentHandlers.json = function(xhr){
// | return dojox.secure.fromJson.fromJson(xhr.responseText);
// | };
//
// json: String
// per RFC 4627
// optReviver: Function (this:Object, string, *)
// optional function
// json: String
// per RFC 4627
// optReviver: Function (this:Object, string, *)
// optional function
// that reworks JSON objects post-parse per Chapter 15.12 of EcmaScript3.1.
// If supplied, the function is called with a string key, and a value.
// The value is the property of 'this'. The reviver should return
Expand All @@ -57,7 +57,7 @@ dojox.secure.fromJson = typeof JSON != "undefined" ? JSON.parse :
// If the reviver returns {@code undefined} then the property named by key
// will be deleted from its container.
// {@code this} is bound to the object containing the specified property.
// returns: {Object|Array}
// returns: Object|Array
(function () {
var number
= '(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)';
Expand Down

0 comments on commit 346921f

Please sign in to comment.