global.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Global</title>
  6. <script src="scripts/prettify/prettify.js"> </script>
  7. <script src="scripts/prettify/lang-css.js"> </script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  12. <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  13. </head>
  14. <body>
  15. <div id="main">
  16. <h1 class="page-title">Global</h1>
  17. <section>
  18. <header>
  19. <h2></h2>
  20. </header>
  21. <article>
  22. <div class="container-overview">
  23. <dl class="details">
  24. </dl>
  25. </div>
  26. <h3 class="subsection-title">Members</h3>
  27. <h4 class="name" id="BlockPyInterface"><span class="type-signature"></span>BlockPyInterface<span class="type-signature"></span></h4>
  28. <div class="description">
  29. An automatically generated file, based on interface.html. An interesting problem in web development is managing HTML code in JS files. Rather than embedding string literals and concatenating them, or some other hackish soluion, we simply convert an HTML file to a JS string. Therefore, relevant edits should be in interface.html instead. The BlockPyInterface global can be seen as a constant representation of the default interface.
  30. </div>
  31. <dl class="details">
  32. <dt class="tag-source">Source:</dt>
  33. <dd class="tag-source"><ul class="dummy"><li>
  34. <a href="interface.js.html">interface.js</a>, <a href="interface.js.html#line13">line 13</a>
  35. </li></ul></dd>
  36. </dl>
  37. <h4 class="name" id="EXTENDED_ERROR_EXPLANATION"><span class="type-signature"></span>EXTENDED_ERROR_EXPLANATION<span class="type-signature"></span></h4>
  38. <div class="description">
  39. A dictionary of improved explanations for Python errors. These are shown to users
  40. alongside the regular errors to hopefully increase clarity.
  41. </div>
  42. <dl class="details">
  43. <dt class="tag-source">Source:</dt>
  44. <dd class="tag-source"><ul class="dummy"><li>
  45. <a href="python_errors.js.html">python_errors.js</a>, <a href="python_errors.js.html#line5">line 5</a>
  46. </li></ul></dd>
  47. </dl>
  48. <h4 class="name" id="timerGuard"><span class="type-signature"></span>timerGuard<span class="type-signature"></span></h4>
  49. <div class="description">
  50. Attempts to update the model for the current code file from the
  51. text editor. Might be prevented if an update event was already
  52. percolating. Also unhighlights any lines.
  53. </div>
  54. <dl class="details">
  55. <dt class="tag-source">Source:</dt>
  56. <dd class="tag-source"><ul class="dummy"><li>
  57. <a href="editor.js.html">editor.js</a>, <a href="editor.js.html#line557">line 557</a>
  58. </li></ul></dd>
  59. </dl>
  60. <h3 class="subsection-title">Methods</h3>
  61. <h4 class="name" id="cloneNode"><span class="type-signature"></span>cloneNode<span class="signature">(node)</span><span class="type-signature"> &rarr; {Node}</span></h4>
  62. <div class="description">
  63. Deeply clones a node
  64. </div>
  65. <h5>Parameters:</h5>
  66. <table class="params">
  67. <thead>
  68. <tr>
  69. <th>Name</th>
  70. <th>Type</th>
  71. <th class="last">Description</th>
  72. </tr>
  73. </thead>
  74. <tbody>
  75. <tr>
  76. <td class="name"><code>node</code></td>
  77. <td class="type">
  78. <span class="param-type">Node</span>
  79. </td>
  80. <td class="description last">A node to clone</td>
  81. </tr>
  82. </tbody>
  83. </table>
  84. <dl class="details">
  85. <dt class="tag-source">Source:</dt>
  86. <dd class="tag-source"><ul class="dummy"><li>
  87. <a href="main.js.html">main.js</a>, <a href="main.js.html#line25">line 25</a>
  88. </li></ul></dd>
  89. </dl>
  90. <h5>Returns:</h5>
  91. <div class="param-desc">
  92. A clone of the given node and all its children
  93. </div>
  94. <dl>
  95. <dt>
  96. Type
  97. </dt>
  98. <dd>
  99. <span class="param-type">Node</span>
  100. </dd>
  101. </dl>
  102. <h4 class="name" id="encodeHTML"><span class="type-signature"></span>encodeHTML<span class="signature">(str)</span><span class="type-signature"> &rarr; {string}</span></h4>
  103. <div class="description">
  104. Encodes some text so that it can be safely written into an HTML box.
  105. This includes replacing special HTML characters (&, <, >, etc.).
  106. </div>
  107. <h5>Parameters:</h5>
  108. <table class="params">
  109. <thead>
  110. <tr>
  111. <th>Name</th>
  112. <th>Type</th>
  113. <th class="last">Description</th>
  114. </tr>
  115. </thead>
  116. <tbody>
  117. <tr>
  118. <td class="name"><code>str</code></td>
  119. <td class="type">
  120. <span class="param-type">string</span>
  121. </td>
  122. <td class="description last">The text to be converted.</td>
  123. </tr>
  124. </tbody>
  125. </table>
  126. <dl class="details">
  127. <dt class="tag-source">Source:</dt>
  128. <dd class="tag-source"><ul class="dummy"><li>
  129. <a href="util.js.html">util.js</a>, <a href="util.js.html#line41">line 41</a>
  130. </li></ul></dd>
  131. </dl>
  132. <h5>Returns:</h5>
  133. <div class="param-desc">
  134. The HTML-safe text.
  135. </div>
  136. <dl>
  137. <dt>
  138. Type
  139. </dt>
  140. <dd>
  141. <span class="param-type">string</span>
  142. </dd>
  143. </dl>
  144. <h4 class="name" id="expandArray"><span class="type-signature"></span>expandArray<span class="signature">(array, addArray, removeArray)</span><span class="type-signature"> &rarr; {Array}</span></h4>
  145. <div class="description">
  146. A helper function for extending an array based
  147. on an "addArray" and "removeArray". Any element
  148. found in removeArray is removed from the first array
  149. and all the elements of addArray are added.
  150. Creates a new array, so is non-destructive.
  151. </div>
  152. <h5>Parameters:</h5>
  153. <table class="params">
  154. <thead>
  155. <tr>
  156. <th>Name</th>
  157. <th>Type</th>
  158. <th class="last">Description</th>
  159. </tr>
  160. </thead>
  161. <tbody>
  162. <tr>
  163. <td class="name"><code>array</code></td>
  164. <td class="type">
  165. <span class="param-type">Array</span>
  166. </td>
  167. <td class="description last">the array to manipulate</td>
  168. </tr>
  169. <tr>
  170. <td class="name"><code>addArray</code></td>
  171. <td class="type">
  172. <span class="param-type">Array</span>
  173. </td>
  174. <td class="description last">the elements to add to the array</td>
  175. </tr>
  176. <tr>
  177. <td class="name"><code>removeArray</code></td>
  178. <td class="type">
  179. <span class="param-type">Array</span>
  180. </td>
  181. <td class="description last">the elements to remove from the array</td>
  182. </tr>
  183. </tbody>
  184. </table>
  185. <dl class="details">
  186. <dt class="tag-source">Source:</dt>
  187. <dd class="tag-source"><ul class="dummy"><li>
  188. <a href="main.js.html">main.js</a>, <a href="main.js.html#line13">line 13</a>
  189. </li></ul></dd>
  190. </dl>
  191. <h5>Returns:</h5>
  192. <div class="param-desc">
  193. The modified array
  194. </div>
  195. <dl>
  196. <dt>
  197. Type
  198. </dt>
  199. <dd>
  200. <span class="param-type">Array</span>
  201. </dd>
  202. </dl>
  203. <h4 class="name" id="indent"><span class="type-signature"></span>indent<span class="signature">(str)</span><span class="type-signature"> &rarr; {String}</span></h4>
  204. <div class="description">
  205. Indents the given string by 4 spaces. This correctly handles multi-line strings.
  206. </div>
  207. <h5>Parameters:</h5>
  208. <table class="params">
  209. <thead>
  210. <tr>
  211. <th>Name</th>
  212. <th>Type</th>
  213. <th class="last">Description</th>
  214. </tr>
  215. </thead>
  216. <tbody>
  217. <tr>
  218. <td class="name"><code>str</code></td>
  219. <td class="type">
  220. <span class="param-type">String</span>
  221. </td>
  222. <td class="description last">The string to be manipulated.</td>
  223. </tr>
  224. </tbody>
  225. </table>
  226. <dl class="details">
  227. <dt class="tag-source">Source:</dt>
  228. <dd class="tag-source"><ul class="dummy"><li>
  229. <a href="engine.js.html">engine.js</a>, <a href="engine.js.html#line318">line 318</a>
  230. </li></ul></dd>
  231. </dl>
  232. <h5>Returns:</h5>
  233. <div class="param-desc">
  234. The string with four spaces added at the start of every new line.
  235. </div>
  236. <dl>
  237. <dt>
  238. Type
  239. </dt>
  240. <dd>
  241. <span class="param-type">String</span>
  242. </dd>
  243. </dl>
  244. <h4 class="name" id="indent"><span class="type-signature"></span>indent<span class="signature">(str, numOfIndents, opt_spacesPerIndent<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {string}</span></h4>
  245. <div class="description">
  246. Indents the given string
  247. </div>
  248. <h5>Parameters:</h5>
  249. <table class="params">
  250. <thead>
  251. <tr>
  252. <th>Name</th>
  253. <th>Type</th>
  254. <th>Attributes</th>
  255. <th class="last">Description</th>
  256. </tr>
  257. </thead>
  258. <tbody>
  259. <tr>
  260. <td class="name"><code>str</code></td>
  261. <td class="type">
  262. <span class="param-type">string</span>
  263. </td>
  264. <td class="attributes">
  265. </td>
  266. <td class="description last">The string to be indented.</td>
  267. </tr>
  268. <tr>
  269. <td class="name"><code>numOfIndents</code></td>
  270. <td class="type">
  271. <span class="param-type">number</span>
  272. </td>
  273. <td class="attributes">
  274. </td>
  275. <td class="description last">The amount of indentations to place at the
  276. beginning of each line of the string.</td>
  277. </tr>
  278. <tr>
  279. <td class="name"><code>opt_spacesPerIndent</code></td>
  280. <td class="type">
  281. <span class="param-type">number</span>
  282. </td>
  283. <td class="attributes">
  284. &lt;optional><br>
  285. </td>
  286. <td class="description last">Optional. If specified, this should be
  287. the number of spaces to be used for each tab that would ordinarily be
  288. used to indent the text. These amount of spaces will also be used to
  289. replace any tab characters that already exist within the string.</td>
  290. </tr>
  291. </tbody>
  292. </table>
  293. <dl class="details">
  294. <dt class="tag-source">Source:</dt>
  295. <dd class="tag-source"><ul class="dummy"><li>
  296. <a href="util.js.html">util.js</a>, <a href="util.js.html#line24">line 24</a>
  297. </li></ul></dd>
  298. </dl>
  299. <h5>Returns:</h5>
  300. <div class="param-desc">
  301. The new string with each line beginning with the desired
  302. amount of indentation.
  303. </div>
  304. <dl>
  305. <dt>
  306. Type
  307. </dt>
  308. <dd>
  309. <span class="param-type">string</span>
  310. </dd>
  311. </dl>
  312. <h4 class="name" id="instructor_module"><span class="type-signature"></span>instructor_module<span class="signature">(name)</span><span class="type-signature"></span></h4>
  313. <div class="description">
  314. Skulpt Module for holding the Instructor API.
  315. This module is a little hackish. We need to sit down and reevaluate the best way to
  316. organize it and whether this particular structure is ideal. I suspect it should be
  317. it's own proper JS file.
  318. </div>
  319. <h5>Parameters:</h5>
  320. <table class="params">
  321. <thead>
  322. <tr>
  323. <th>Name</th>
  324. <th>Type</th>
  325. <th class="last">Description</th>
  326. </tr>
  327. </thead>
  328. <tbody>
  329. <tr>
  330. <td class="name"><code>name</code></td>
  331. <td class="type">
  332. <span class="param-type">String</span>
  333. </td>
  334. <td class="description last">The name of the module (should always be 'instructor')</td>
  335. </tr>
  336. </tbody>
  337. </table>
  338. <dl class="details">
  339. <dt class="tag-source">Source:</dt>
  340. <dd class="tag-source"><ul class="dummy"><li>
  341. <a href="engine.js.html">engine.js</a>, <a href="engine.js.html#line332">line 332</a>
  342. </li></ul></dd>
  343. </dl>
  344. <h4 class="name" id="prettyPrintDateTime"><span class="type-signature"></span>prettyPrintDateTime<span class="signature">(timeString)</span><span class="type-signature"> &rarr; {String}</span></h4>
  345. <div class="description">
  346. Helper function to parse a date/time string and rewrite it as something
  347. more human readable.
  348. </div>
  349. <h5>Parameters:</h5>
  350. <table class="params">
  351. <thead>
  352. <tr>
  353. <th>Name</th>
  354. <th>Type</th>
  355. <th class="last">Description</th>
  356. </tr>
  357. </thead>
  358. <tbody>
  359. <tr>
  360. <td class="name"><code>timeString</code></td>
  361. <td class="type">
  362. <span class="param-type">String</span>
  363. </td>
  364. <td class="description last">the string representation of time ("YYYYMMDD HHMMSS")</td>
  365. </tr>
  366. </tbody>
  367. </table>
  368. <dl class="details">
  369. <dt class="tag-source">Source:</dt>
  370. <dd class="tag-source"><ul class="dummy"><li>
  371. <a href="history.js.html">history.js</a>, <a href="history.js.html#line31">line 31</a>
  372. </li></ul></dd>
  373. </dl>
  374. <h5>Returns:</h5>
  375. <div class="param-desc">
  376. - A human-readable time string.
  377. </div>
  378. <dl>
  379. <dt>
  380. Type
  381. </dt>
  382. <dd>
  383. <span class="param-type">String</span>
  384. </dd>
  385. </dl>
  386. <h4 class="name" id="randomInteger"><span class="type-signature"></span>randomInteger<span class="signature">(min, max)</span><span class="type-signature"> &rarr; {number}</span></h4>
  387. <div class="description">
  388. Return a random integer between [`min`, `max`].
  389. </div>
  390. <h5>Parameters:</h5>
  391. <table class="params">
  392. <thead>
  393. <tr>
  394. <th>Name</th>
  395. <th>Type</th>
  396. <th class="last">Description</th>
  397. </tr>
  398. </thead>
  399. <tbody>
  400. <tr>
  401. <td class="name"><code>min</code></td>
  402. <td class="type">
  403. <span class="param-type">number</span>
  404. </td>
  405. <td class="description last">The lowest possible integer.</td>
  406. </tr>
  407. <tr>
  408. <td class="name"><code>max</code></td>
  409. <td class="type">
  410. <span class="param-type">number</span>
  411. </td>
  412. <td class="description last">The highest possible integer (inclusive).</td>
  413. </tr>
  414. </tbody>
  415. </table>
  416. <dl class="details">
  417. <dt class="tag-source">Source:</dt>
  418. <dd class="tag-source"><ul class="dummy"><li>
  419. <a href="util.js.html">util.js</a>, <a href="util.js.html#line8">line 8</a>
  420. </li></ul></dd>
  421. </dl>
  422. <h5>Returns:</h5>
  423. <div class="param-desc">
  424. A random integer.
  425. </div>
  426. <dl>
  427. <dt>
  428. Type
  429. </dt>
  430. <dd>
  431. <span class="param-type">number</span>
  432. </dd>
  433. </dl>
  434. <h4 class="name" id="set_button_loaded"><span class="type-signature"></span>set_button_loaded<span class="signature">(btn)</span><span class="type-signature"></span></h4>
  435. <div class="description">
  436. This is a very simplistic helper function that will transform
  437. a given button into a "Loaded" state (disabled, pressed state, etc.).
  438. </div>
  439. <h5>Parameters:</h5>
  440. <table class="params">
  441. <thead>
  442. <tr>
  443. <th>Name</th>
  444. <th>Type</th>
  445. <th class="last">Description</th>
  446. </tr>
  447. </thead>
  448. <tbody>
  449. <tr>
  450. <td class="name"><code>btn</code></td>
  451. <td class="type">
  452. <span class="param-type">HTMLElement</span>
  453. </td>
  454. <td class="description last">An HTML element to change the text of.</td>
  455. </tr>
  456. </tbody>
  457. </table>
  458. <dl class="details">
  459. <dt class="tag-source">Source:</dt>
  460. <dd class="tag-source"><ul class="dummy"><li>
  461. <a href="corgis.js.html">corgis.js</a>, <a href="corgis.js.html#line129">line 129</a>
  462. </li></ul></dd>
  463. </dl>
  464. </article>
  465. </section>
  466. </div>
  467. <nav>
  468. <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BlockPy.html">BlockPy</a></li><li><a href="BlockPyCorgis.html">BlockPyCorgis</a></li><li><a href="BlockPyDialog.html">BlockPyDialog</a></li><li><a href="BlockPyEditor.html">BlockPyEditor</a></li><li><a href="BlockPyEngine.html">BlockPyEngine</a></li><li><a href="BlockPyEnglish.html">BlockPyEnglish</a></li><li><a href="BlockPyFeedback.html">BlockPyFeedback</a></li><li><a href="BlockPyHistory.html">BlockPyHistory</a></li><li><a href="BlockPyPresentation.html">BlockPyPresentation</a></li><li><a href="BlockPyPrinter.html">BlockPyPrinter</a></li><li><a href="BlockPyServer.html">BlockPyServer</a></li><li><a href="BlockPyToolbar.html">BlockPyToolbar</a></li><li><a href="LocalStorageWrapper.html">LocalStorageWrapper</a></li><li><a href="PythonToBlocks.html">PythonToBlocks</a></li></ul><h3>Global</h3><ul><li><a href="global.html#BlockPyInterface">BlockPyInterface</a></li><li><a href="global.html#cloneNode">cloneNode</a></li><li><a href="global.html#encodeHTML">encodeHTML</a></li><li><a href="global.html#expandArray">expandArray</a></li><li><a href="global.html#EXTENDED_ERROR_EXPLANATION">EXTENDED_ERROR_EXPLANATION</a></li><li><a href="global.html#indent">indent</a></li><li><a href="global.html#instructor_module">instructor_module</a></li><li><a href="global.html#prettyPrintDateTime">prettyPrintDateTime</a></li><li><a href="global.html#randomInteger">randomInteger</a></li><li><a href="global.html#set_button_loaded">set_button_loaded</a></li><li><a href="global.html#timerGuard">timerGuard</a></li></ul>
  469. </nav>
  470. <br class="clear">
  471. <footer>
  472. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Mar 26 2017 09:45:03 GMT-0400 (Eastern Daylight Time)
  473. </footer>
  474. <script> prettyPrint(); </script>
  475. <script src="scripts/linenumber.js"> </script>
  476. </body>
  477. </html>