basica
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -1587,3 +1587,3 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var DEFAULT_PROMPT_NONE = null; | ||
var ECHO_HANDLER = function(console, cmd) { console.print(cmd); console.newline(); } | ||
var NULL_HANDLER = function(console, cmd) { console.newline(); } | ||
@@ -1621,3 +1621,4 @@ // | ||
this._prompt = null; | ||
this._handler = opts.handler || ECHO_HANDLER; | ||
this._handler = opts.handler || NULL_HANDLER; | ||
this._cancel = opts.cancel || NULL_HANDLER; | ||
this._cursor = null; | ||
@@ -1649,4 +1650,2 @@ this._inputLine = null; | ||
this.newline(); | ||
} | ||
@@ -1657,2 +1656,10 @@ | ||
Console.prototype.setHandler = function(handler) { | ||
this._handler = handler || NULL_HANDLER; | ||
} | ||
Console.prototype.setPrompt = function(prompt) { | ||
this._prompt = prompt; | ||
} | ||
Console.prototype.getInput = function() { | ||
@@ -1670,4 +1677,2 @@ | ||
Console.prototype.print = function(str) { | ||
if (!str) return; | ||
@@ -1803,3 +1808,3 @@ var start = 0, end = str.indexOf("\n", start); | ||
} else if (this.state === S_PROCESSING) { | ||
// send cancel message to handler? | ||
this._cancel(this); | ||
} | ||
@@ -1815,2 +1820,3 @@ break; | ||
// Enter | ||
if (evt.charCode === 13 || evt.keyCode === 13) { | ||
@@ -1820,2 +1826,4 @@ evt.preventDefault(); | ||
input = this.getInput(); | ||
du.removeClass(this._cursor, 'cursor'); | ||
this._cursor = null; | ||
this.state = S_PROCESSING; | ||
@@ -1927,3 +1935,3 @@ this._handler(this, input); | ||
this.root.appendChild(line); | ||
this._appendRaw(line); | ||
@@ -1938,6 +1946,15 @@ } | ||
this.root.appendChild(wrap); | ||
this._appendRaw(el); | ||
} | ||
Console.prototype._appendRaw = function(el) { | ||
if (this.state === S_INPUT) { | ||
this.root.insertBefore(el, this._inputLine); | ||
} else { | ||
this.root.appendChild(el); | ||
} | ||
this._scrollToBottom(); | ||
} | ||
Console.prototype._insertStringBeforeCursor = function(str) { | ||
@@ -2255,7 +2272,7 @@ if (!this._cursor) return; | ||
"name": "basica", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "BASIC interpreter", | ||
"main": "index.js", | ||
"dependencies": { | ||
"echo-chamber": "~0.1.2", | ||
"echo-chamber": "~0.3.0", | ||
"domutil": "~0.3.5", | ||
@@ -2262,0 +2279,0 @@ "pegjs": "~0.8.0" |
{ | ||
"name": "basica", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "BASIC interpreter", | ||
"main": "index.js", | ||
"dependencies": { | ||
"echo-chamber": "~0.1.2", | ||
"echo-chamber": "~0.3.0", | ||
"domutil": "~0.3.5", | ||
@@ -9,0 +9,0 @@ "pegjs": "~0.8.0" |
126093
3405
+ Addeddom-bind@1.0.0(transitive)
+ Addeddom-matchesselector@1.0.0(transitive)
+ Addeddomutil@1.0.7(transitive)
+ Addedecho-chamber@0.3.2(transitive)
- Removedecho-chamber@0.1.2(transitive)
Updatedecho-chamber@~0.3.0