Permalink
Browse files

Various cleanup [1/n]

- Move script loading functionality out of mscorlib into loader.js/script.web assembly
- Move alert and related methods to Window class in Script.Web
- Move setTimeout and related methods to Script class in mscorlib
- Remove IE-specific XMLHttpRequest/XML parsing wrappers from mscorlib.js
  • Loading branch information...
nikhilk committed Aug 26, 2012
1 parent 5769f30 commit 54bae4a42b4d67a6fadb46665c6a1b761d712a83
View
@@ -1,7 +1,18 @@
Changelog
===============================================================================
-v0.7.5.0 [in progress]
+v0.7.6
+ - Removed script loading APIs from Script class in mscorlib
+ (moved them to Loader class in Script.Web)
+ - Removed script startup functionality from mscorlib.js ... all script
+ loading is now in ssloader.js (and included into the Runtime nuget
+ package)
+ - Removed Script.Alert/Confirm/Prompt from mscorlib and moved them to
+ Window in Script.Web
+ - Moved SetTimeout, SetInterval and ClearTimeout, ClearInterval from
+ Window object to Script object in mscorlib.
+
+v0.7.5.0
- DOM metadata update (readyState property on Document,
plugins on Navigator)
- jQuery API update (on/off methods)
@@ -91,7 +91,6 @@
<Compile Include="Globalization\CultureInfo.cs" />
<Compile Include="Globalization\DateFormatInfo.cs" />
<Compile Include="Globalization\NumberFormatInfo.cs" />
- <Compile Include="ScriptInfo.cs" />
<Compile Include="Serialization\JsonStringifyCallback.cs" />
<Compile Include="Serialization\JsonParseCallback.cs" />
<Compile Include="Serialization\Json.cs" />
View
@@ -16,37 +16,6 @@ namespace System {
[Imported]
public static class Script {
- /// <summary>
- /// Displays a message box containing the specified message text.
- /// </summary>
- /// <param name="message">The text of the message.</param>
- public static void Alert(string message) {
- }
-
- /// <summary>
- /// Displays a message box containing the specified value converted
- /// into a string.
- /// </summary>
- /// <param name="b">The boolean to display.</param>
- public static void Alert(bool b) {
- }
-
- /// <summary>
- /// Displays a message box containing the specified value converted
- /// into a string.
- /// </summary>
- /// <param name="d">The date to display.</param>
- public static void Alert(Date d) {
- }
-
- /// <summary>
- /// Displays a message box containing the specified value converted
- /// into a string.
- /// </summary>
- /// <param name="n">The number to display.</param>
- public static void Alert(Number n) {
- }
-
/// <summary>
/// Converts an object into a boolean.
/// </summary>
@@ -56,11 +25,18 @@ public static class Script {
return false;
}
+ public static void ClearInterval(int intervalID) {
+ }
+
+ public static void ClearTimeout(int timeoutID) {
+ }
+
/// <summary>
/// Prompts the user with a yes/no question.
/// </summary>
/// <param name="message">The text of the question.</param>
/// <returns>true if the user chooses yes; false otherwise.</returns>
+ [Obsolete("Use Window.Confirm instead.", true)]
public static bool Confirm(string message) {
return false;
}
@@ -133,80 +109,44 @@ public static class Script {
return null;
}
- /// <summary>
- /// Loads the specified scripts.
- /// </summary>
- /// <param name="scriptNames">The names of scripts that are required and must be loaded.</param>
- [ScriptAlias("ss.loadScripts")]
- public static void LoadScripts(string[] scriptNames) {
+ public static int SetInterval(string code, int milliseconds) {
+ return 0;
}
- /// <summary>
- /// Loads the specified scripts and invokes the specified callback once they have been
- /// loaded.
- /// </summary>
- /// <param name="scriptNames">The names of scripts that are required and must be loaded.</param>
- /// <param name="callback">A callback to be invoked once the scripts have been loaded.</param>
- [ScriptAlias("ss.loadScripts")]
- public static void LoadScripts(string[] scriptNames, Action callback) {
+ public static int SetInterval(Action callback, int milliseconds) {
+ return 0;
}
- /// <summary>
- /// Loads the specified scripts and invokes the specified callback once they have been
- /// loaded.
- /// </summary>
- /// <param name="scriptNames">The names of scripts that are required and must be loaded.</param>
- /// <param name="callback">A callback to be invoked once the scripts have been loaded.</param>
- /// <param name="context">The object to be passed in into the callback.</param>
- /// <typeparam name="TContext">The type of the context object.</typeparam>
- [ScriptAlias("ss.loadScripts")]
- public static void LoadScripts<TContext>(string[] scriptNames, Action<TContext> callback, TContext context) {
+ public static int SetInterval<T>(Action<T> callback, int milliseconds, T arg) {
+ return 0;
}
- /// <summary>
- /// Registers the specified callback to be invoked when the DOM is ready,
- /// and before any script loading has begun.
- /// </summary>
- /// <param name="callback">The callback to invoke.</param>
- [ScriptAlias("ss.init")]
- public static void OnInit(Action callback) {
+ public static int SetInterval<T1, T2>(Action<T1, T2> callback, int milliseconds, T1 arg1, T2 arg2) {
+ return 0;
}
- /// <summary>
- /// Registers a callback to be invoked once any necessary scripts
- /// have been loaded.
- /// </summary>
- /// <param name="callback">The callback to be invoked.</param>
- [ScriptAlias("ss.ready")]
- public static void OnReady(Action callback) {
+ public static int SetInterval(Delegate d, int milliseconds, params object[] args) {
+ return 0;
}
- /// <summary>
- /// Prompts the user to enter a value.
- /// </summary>
- /// <param name="message">The text of the prompt.</param>
- /// <returns>The value entered by the user.</returns>
- public static string Prompt(string message) {
- return null;
+ public static int SetTimeout(string code, int milliseconds) {
+ return 0;
}
- /// <summary>
- /// Prompts the user to enter a value, along with providing a default
- /// value.
- /// </summary>
- /// <param name="message">The text of the prompt.</param>
- /// <param name="defaultValue">The default value for the prompt.</param>
- /// <returns>The value entered by the user.</returns>
- public static string Prompt(string message, string defaultValue) {
- return null;
+ public static int SetTimeout(Action callback, int milliseconds) {
+ return 0;
}
- /// <summary>
- /// Registers information about a script.
- /// </summary>
- /// <param name="scriptInfo">The information about a script.</param>
- [ScriptAlias("ss.registerScript")]
- public static void RegisterScript(ScriptInfo scriptInfo) {
+ public static int SetTimeout<T>(Action<T> callback, int milliseconds, T arg) {
+ return 0;
+ }
+
+ public static int SetTimeout<T1, T2>(Action<T1, T2> callback, int milliseconds, T1 arg1, T2 arg2) {
+ return 0;
+ }
+
+ public static int SetTimeout(Delegate d, int milliseconds, params object[] args) {
+ return 0;
}
/// <summary>
@@ -473,7 +473,7 @@
});
}
- window.ss = {
+ window.loader = {
load: _startup,
loadScripts: loadScripts,
checkScripts: checkScripts,
@@ -3,8 +3,8 @@
//!
(function () {
- var globals = {
- version: '0.7.4.0',
+ window.ss = {
+ version: '0.7.6.0',
isUndefined: function (o) {
return (o === undefined);
@@ -22,41 +22,6 @@
return (o !== null) && (o !== undefined);
}
};
-
- var started = false;
- var startCallbacks = [];
-
- function onStartup(cb) {
- startCallbacks ? startCallbacks.push(cb) : setTimeout(cb, 0);
- }
- function startup() {
- if (startCallbacks) {
- var callbacks = startCallbacks;
- startCallbacks = null;
- for (var i = 0, l = callbacks.length; i < l; i++) {
- callbacks[i]();
- }
- }
- }
- if (document.addEventListener) {
- document.readyState == 'complete' ? startup() : document.addEventListener('DOMContentLoaded', startup, false);
- }
- else if (window.attachEvent) {
- window.attachEvent('onload', function () {
- startup();
- });
- }
-
- var ss = window.ss;
- if (!ss) {
- window.ss = ss = {
- init: onStartup,
- ready: onStartup
- };
- }
- for (var n in globals) {
- ss[n] = globals[n];
- }
})();
#include "Extensions\Object.js"
@@ -95,51 +60,6 @@
#include "BCL\EventArgs.js"
-///////////////////////////////////////////////////////////////////////////////
-// XMLHttpRequest and XML parsing helpers
-
-if (!window.XMLHttpRequest) {
- window.XMLHttpRequest = function() {
- var progIDs = [ 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP' ];
-
- for (var i = 0; i < progIDs.length; i++) {
- try {
- var xmlHttp = new ActiveXObject(progIDs[i]);
- return xmlHttp;
- }
- catch (ex) {
- }
- }
-
- return null;
- }
-}
-
-ss.parseXml = function(markup) {
- try {
- if (DOMParser) {
- var domParser = new DOMParser();
- return domParser.parseFromString(markup, 'text/xml');
- }
- else {
- var progIDs = [ 'Msxml2.DOMDocument.3.0', 'Msxml2.DOMDocument' ];
-
- for (var i = 0; i < progIDs.length; i++) {
- var xmlDOM = new ActiveXObject(progIDs[i]);
- xmlDOM.async = false;
- xmlDOM.loadXML(markup);
- xmlDOM.setProperty('SelectionLanguage', 'XPath');
-
- return xmlDOM;
- }
- }
- }
- catch (ex) {
- }
-
- return null;
-}
-
#include "BCL\CancelEventArgs.js"
#include "BCL\Tuple.js"
Oops, something went wrong.

0 comments on commit 54bae4a

Please sign in to comment.