git @ Cat's Eye Technologies yoob.js / 55d8234
throw Error objects instead of alert()ing when errors happen. Chris Pressey 6 years ago
4 changed file(s) with 16 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
00 /*
1 * This file is part of yoob.js version 0.11
1 * This file is part of yoob.js version 0.12-PRE
22 * Available from https://github.com/catseye/yoob.js/
33 * This file is in the public domain. See http://unlicense.org/ for details.
44 */
196196 * - `block` to indicate that the program is waiting for more input.
197197 */
198198 this.step = function() {
199 alert("step() NotImplementedError");
199 throw new Error("step() NotImplementedError");
200200 };
201201
202202 /******************
265265 };
266266
267267 this.reset = function(state) {
268 alert("reset() NotImplementedError");
268 throw new Error("reset() NotImplementedError");
269269 };
270270
271271 this.setResetState = function(state) {
00 /*
1 * This file is part of yoob.js version 0.11
1 * This file is part of yoob.js version 0.12-PRE
22 * Available from https://github.com/catseye/yoob.js/
33 * This file is in the public domain. See http://unlicense.org/ for details.
44 */
132132 this.put(x, y, this.get(x, y - dy));
133133 }
134134 }
135 } else { alert("scrollRectangleY(" + dy + ") notImplemented"); }
135 } else {
136 throw new Error("scrollRectangleY(" + dy + ") notImplemented");
137 }
136138 };
137139
138140 this.clearRectangle = function(minX, minY, maxX, maxY) {
00 /*
1 * This file is part of yoob.js version 0.8
1 * This file is part of yoob.js version 0.12-PRE
22 * Available from https://github.com/catseye/yoob.js/
33 * This file is in the public domain. See http://unlicense.org/ for details.
44 */
6767 };
6868
6969 this.setPreset = function(id) {
70 alert("No default setPreset callback configured");
70 throw new Error("No default setPreset callback configured");
7171 };
7272
7373 /*
00 /*
1 * This file is part of yoob.js version 0.7
1 * This file is part of yoob.js version 0.12-PRE
22 * Available from https://github.com/catseye/yoob.js/
33 * This file is in the public domain. See http://unlicense.org/ for details.
44 */
1818 if (this.state[nm].init) {
1919 this.state[nm].init();
2020 } else {
21 alert('Internal error: "' + nm + '" must implement .init');
21 throw new Error('"' + nm + '" must implement .init');
2222 }
2323 }
2424 return this;
3333 if (this.currentState.onleave) {
3434 this.currentState.onleave();
3535 } else {
36 alert('Internal error: "' + nm + '" must implement .onleave');
36 throw new Error('"' + nm + '" must implement .onleave');
3737 }
3838 }
3939 var state = this.state[nm];
4141 if (state.onenter) {
4242 state.onenter(args);
4343 } else {
44 alert('Internal error: "' + nm + '" must implement .onenter');
44 throw new Error('"' + nm + '" must implement .onenter');
4545 }
4646 return this;
4747 };
5252 */
5353 yoob.State = function() {
5454 this.init = function() {
55 alert("You must implement .init()");
55 throw new Error("You must implement .init()");
5656 };
5757
5858 /*
6565 * should only do so as the last thing in the handler.
6666 */
6767 this.onenter = function(args) {
68 alert("You must implement .onenter()");
68 throw new Error("You must implement .onenter()");
6969 };
7070
7171 /*
7575 * Cancel timers/animations
7676 */
7777 this.onleave = function() {
78 alert("You must implement .onleave()");
78 throw new Error("You must implement .onleave()");
7979 };
8080 };