1
0

diff.rhs.txt 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /*
  2. © Microsoft. All rights reserved.
  3. This library is supported for use in Windows Tailored Apps only.
  4. Build: 6.2.8100.0
  5. Version: 0.5
  6. */
  7. // Here are some inserted lines
  8. // with some extra comments
  9. (function (global, undefined) {
  10. "use strict";
  11. var definedVariable = {};
  12. definedVariable.prop = 5;
  13. function initializeProperties(target, members) {
  14. var keys = Object.keys(members);
  15. var properties;
  16. var i, len;
  17. for (i = 0, len = keys.length; i < len; i++) {
  18. var key = keys[i];
  19. var enumerable = key.charCodeAt(0) !== /*_*/95;
  20. var member = members[key];
  21. if (member && typeof member === 'object') {
  22. if (member.value !== undefined || typeof member.get === 'function' || typeof member.set === 'function') {
  23. if (member.enumerable === undefined) {
  24. member.enumerable = enumerable;
  25. }
  26. properties = properties || {};
  27. properties[key] = member;
  28. continue;
  29. }
  30. }
  31. target[key] = member;
  32. }
  33. if (properties) {
  34. Object.defineProperties(target, properties);
  35. }
  36. }
  37. (function (rootNamespace) {
  38. // Create the rootNamespace in the global namespace
  39. if (!global[rootNamespace]) {
  40. global[rootNamespace] = Object.create(Object.prototype);
  41. }
  42. // Cache the rootNamespace we just created in a local variable
  43. var _rootNamespace = global[rootNamespace];
  44. if (!_rootNamespace.Namespace) {
  45. _rootNamespace.Namespace = Object.create(Object.prototype);
  46. }
  47. function defineWithParent(parentNamespace, name, members) {
  48. /// <summary locid="1">
  49. /// Defines a new namespace with the specified name, under the specified parent namespace.
  50. /// </summary>
  51. /// <param name="parentNamespace" type="Object" locid="2">
  52. /// The parent namespace which will contain the new namespace.
  53. /// </param>
  54. /// <param name="name" type="String" locid="3">
  55. /// Name of the new namespace.
  56. /// </param>
  57. /// <param name="members" type="Object" locid="4">
  58. /// Members in the new namespace.
  59. /// </param>
  60. /// <returns locid="5">
  61. /// The newly defined namespace.
  62. /// </returns>
  63. var currentNamespace = parentNamespace,
  64. namespaceFragments = name.split(".");
  65. for (var i = 0, len = namespaceFragments.length; i < len; i++) {
  66. var namespaceName = namespaceFragments[i];
  67. if (!currentNamespace[namespaceName]) {
  68. Object.defineProperty(currentNamespace, namespaceName,
  69. { value: {}, writable: false, enumerable: true, configurable: true }
  70. );
  71. }
  72. currentNamespace = currentNamespace[namespaceName];
  73. }
  74. if (members) {
  75. initializeProperties(currentNamespace, members);
  76. }
  77. return currentNamespace;
  78. }
  79. function define(name, members) {
  80. /// <summary locid="6">
  81. /// Defines a new namespace with the specified name.
  82. /// </summary>
  83. /// <param name="name" type="String" locid="7">
  84. /// Name of the namespace. This could be a dot-separated nested name.
  85. /// </param>
  86. /// <param name="members" type="Object" locid="4">
  87. /// Members in the new namespace.
  88. /// </param>
  89. /// <returns locid="5">
  90. /// The newly defined namespace.
  91. /// </returns>
  92. return defineWithParent(global, name, members);
  93. }
  94. // Establish members of the "WinJS.Namespace" namespace
  95. Object.defineProperties(_rootNamespace.Namespace, {
  96. defineWithParent: { value: defineWithParent, writable: true, enumerable: true },
  97. define: { value: define, writable: true, enumerable: true }
  98. });
  99. })("WinJS");
  100. (function (WinJS) {
  101. function define(constructor, instanceMembers, staticMembers) {
  102. /// <summary locid="8">
  103. /// Defines a class using the given constructor and with the specified instance members.
  104. /// </summary>
  105. /// <param name="constructor" type="Function" locid="9">
  106. /// A constructor function that will be used to instantiate this class.
  107. /// </param>
  108. /// <param name="instanceMembers" type="Object" locid="10">
  109. /// The set of instance fields, properties and methods to be made available on the class.
  110. /// </param>
  111. /// <param name="staticMembers" type="Object" locid="11">
  112. /// The set of static fields, properties and methods to be made available on the class.
  113. /// </param>
  114. /// <returns type="Function" locid="12">
  115. /// The newly defined class.
  116. /// </returns>
  117. constructor = constructor || function () { };
  118. if (instanceMembers) {
  119. initializeProperties(constructor.prototype, instanceMembers);
  120. }
  121. if (staticMembers) {
  122. initializeProperties(constructor, staticMembers);
  123. }
  124. return constructor;
  125. }
  126. function derive(baseClass, constructor, instanceMembers, staticMembers) {
  127. /// <summary locid="13">
  128. /// Uses prototypal inheritance to create a sub-class based on the supplied baseClass parameter.
  129. /// </summary>
  130. /// <param name="baseClass" type="Function" locid="14">
  131. /// The class to inherit from.
  132. /// </param>
  133. /// <param name="constructor" type="Function" locid="9">
  134. /// A constructor function that will be used to instantiate this class.
  135. /// </param>
  136. /// <param name="instanceMembers" type="Object" locid="10">
  137. /// The set of instance fields, properties and methods to be made available on the class.
  138. /// </param>
  139. /// <param name="staticMembers" type="Object" locid="11">
  140. /// The set of static fields, properties and methods to be made available on the class.
  141. /// </param>
  142. /// <returns type="Function" locid="12">
  143. /// The newly defined class.
  144. /// </returns>
  145. if (baseClass) {
  146. constructor = constructor || function () { };
  147. var basePrototype = baseClass.prototype;
  148. constructor.prototype = Object.create(basePrototype);
  149. Object.defineProperty(constructor.prototype, "_super", { value: basePrototype });
  150. Object.defineProperty(constructor.prototype, "constructor", { value: constructor });
  151. if (instanceMembers) {
  152. initializeProperties(constructor.prototype, instanceMembers);
  153. }
  154. if (staticMembers) {
  155. initializeProperties(constructor, staticMembers);
  156. }
  157. return constructor;
  158. } else {
  159. return define(constructor, instanceMembers, staticMembers);
  160. }
  161. }
  162. function mix(constructor) {
  163. /// <summary locid="15">
  164. /// Defines a class using the given constructor and the union of the set of instance members
  165. /// specified by all the mixin objects. The mixin parameter list can be of variable length.
  166. /// </summary>
  167. /// <param name="constructor" locid="9">
  168. /// A constructor function that will be used to instantiate this class.
  169. /// </param>
  170. /// <returns locid="12">
  171. /// The newly defined class.
  172. /// </returns>
  173. constructor = constructor || function () { };
  174. var i, len;
  175. for (i = 0, len = arguments.length; i < len; i++) {
  176. initializeProperties(constructor.prototype, arguments[i]);
  177. }
  178. return constructor;
  179. }
  180. // Establish members of "WinJS.Class" namespace
  181. WinJS.Namespace.define("WinJS.Class", {
  182. define: define,
  183. derive: derive,
  184. mix: mix
  185. });
  186. })(WinJS);
  187. })(this);