From 06f9007369d6202554d37711bebb97f0d328ef93 Mon Sep 17 00:00:00 2001 From: walterhiggins Date: Sun, 5 Jan 2014 17:20:54 +0000 Subject: [PATCH] self is available for autocompletion --- docs/API-Reference.md | 16 ++++++++++------ docs/release-notes.md | 2 ++ src/main/javascript/lib/tabcomplete.js | 4 ++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/API-Reference.md b/docs/API-Reference.md index a53566b..61cad66 100644 --- a/docs/API-Reference.md +++ b/docs/API-Reference.md @@ -50,9 +50,8 @@ Walter Higgins * [Examples](#examples) * [Fireworks Module](#fireworks-module) * [Examples](#examples) - * [http.request() function](#httprequest-function) - * [Parameters](#parameters) - * [Example](#example) + * [Http Module](#http-module) + * [http.request() function](#httprequest-function) * [Signs Module](#signs-module) * [signs.menu() function](#signsmenu-function) * [signs.getTargetedBy() function](#signsgettargetedby-function) @@ -784,7 +783,12 @@ location. For example... ![firework example](img/firework.png) -## http.request() function +## Http Module + +For handling http requests. Not to be confused with the more robust +and functional 'http' module bundled with Node.js. + +### http.request() function The http.request() function will fetch a web address asynchronously (on a separate thread)and pass the URL's response to a callback function @@ -792,7 +796,7 @@ which will be executed synchronously (on the main thread). In this way, http.request() can be used to fetch web content without blocking the main thread of execution. -### Parameters +#### Parameters * request: The request details either a plain URL e.g. "http://scriptcraft.js/sample.json" or an object with the following properties... @@ -804,7 +808,7 @@ main thread of execution. - responseCode: The numeric response code from the server. If the server did not respond with 200 OK then the response parameter will be undefined. - response: A string (if the response is of type text) or object containing the HTTP response body. -### Example +#### Example The following example illustrates how to use http.request to make a request to a JSON web service and evaluate its response... diff --git a/docs/release-notes.md b/docs/release-notes.md index 87a6af8..9445e24 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -6,6 +6,8 @@ Bug Fix: On Mac OS, alias plugin caused Exceptions due to missing Changed target for compilation to 1.6 so that ScriptCraft will work with both java 1.6 and 1.7. +Added documentation for the Signs module. + # 2014 01 02 Added a warning in console at start-up if legacy directories are detected. diff --git a/src/main/javascript/lib/tabcomplete.js b/src/main/javascript/lib/tabcomplete.js index 9b85d3d..2a2d560 100644 --- a/src/main/javascript/lib/tabcomplete.js +++ b/src/main/javascript/lib/tabcomplete.js @@ -78,6 +78,8 @@ var onTabCompleteJS = function( __onTC_result, __onTC_sender, __onTC_cmd, __onTC if (__onTC_cmd.name == 'jsp') return tabCompleteJSP( __onTC_result, __onTC_sender, __onTC_cmd, __onTC_alias, __onTC_args ); + global.self = __onTC_sender; // bring in self just for autocomplete + var _globalSymbols = _getProperties(global) var result = __onTC_result; var args = __onTC_args; @@ -169,5 +171,7 @@ var onTabCompleteJS = function( __onTC_result, __onTC_sender, __onTC_cmd, __onTC } for (var i = 0;i < propsOfLastArg.length; i++) result.add(propsOfLastArg[i]); + + delete global.self; // delete self when no longer needed for autocomplete }; module.exports = onTabCompleteJS;