summaryrefslogtreecommitdiff
path: root/objects.js
diff options
context:
space:
mode:
authorNathan Dinsmore <nathan@users.noreply.github.com>2015-06-17 17:11:40 -0400
committerNathan Dinsmore <nathan@users.noreply.github.com>2015-06-17 17:11:40 -0400
commit87c2503571bd7f5e753bc16a05bd198fc58d7d7c (patch)
tree4545f569b3989ee1d2e5d1cc3e3f31108ea06742 /objects.js
parent3885ced35aee903f74d48c293bc3f0665a38dba5 (diff)
downloadsnap-87c2503571bd7f5e753bc16a05bd198fc58d7d7c.tar.gz
snap-87c2503571bd7f5e753bc16a05bd198fc58d7d7c.zip
Use Object.create(…) instead of new …() for inheritance (faster)
Diffstat (limited to 'objects.js')
-rw-r--r--objects.js22
1 files changed, 11 insertions, 11 deletions
diff --git a/objects.js b/objects.js
index 8cae1c7..462aed2 100644
--- a/objects.js
+++ b/objects.js
@@ -147,7 +147,7 @@ var SpriteHighlightMorph;
// SpriteMorph inherits from PenMorph:
-SpriteMorph.prototype = new PenMorph();
+SpriteMorph.prototype = Object.create(PenMorph.prototype);
SpriteMorph.prototype.constructor = SpriteMorph;
SpriteMorph.uber = PenMorph.prototype;
@@ -583,7 +583,7 @@ SpriteMorph.prototype.initBlocks = function () {
},
/* migrated to a newer block version:
-
+
receiveClick: {
type: 'hat',
category: 'control',
@@ -3008,7 +3008,7 @@ SpriteMorph.prototype.applyGraphicsEffects = function (canvas) {
var i;
if (value !== 0) {
for (i = 0; i < p.length; i += 4) {
- p[i] += value; //255 = 100% of this color
+ p[i] += value; //255 = 100% of this color
p[i + 1] += value;
p[i + 2] += value;
}
@@ -4289,7 +4289,7 @@ SpriteMorph.prototype.doScreenshot = function (imgSource, data) {
// SpriteHighlightMorph inherits from Morph:
-SpriteHighlightMorph.prototype = new Morph();
+SpriteHighlightMorph.prototype = Object.create(Morph.prototype);
SpriteHighlightMorph.prototype.constructor = SpriteHighlightMorph;
SpriteHighlightMorph.uber = Morph.prototype;
@@ -4307,7 +4307,7 @@ function SpriteHighlightMorph() {
// StageMorph inherits from FrameMorph:
-StageMorph.prototype = new FrameMorph();
+StageMorph.prototype = Object.create(FrameMorph.prototype);
StageMorph.prototype.constructor = StageMorph;
StageMorph.uber = FrameMorph.prototype;
@@ -5669,7 +5669,7 @@ StageMorph.prototype.replaceDoubleDefinitionsFor
// SpriteBubbleMorph inherits from SpeechBubbleMorph:
-SpriteBubbleMorph.prototype = new SpeechBubbleMorph();
+SpriteBubbleMorph.prototype = Object.create(SpeechBubbleMorph.prototype);
SpriteBubbleMorph.prototype.constructor = SpriteBubbleMorph;
SpriteBubbleMorph.uber = SpeechBubbleMorph.prototype;
@@ -6168,7 +6168,7 @@ Costume.prototype.isTainted = function () {
// SVG_Costume inherits from Costume:
-SVG_Costume.prototype = new Costume();
+SVG_Costume.prototype = Object.create(Costume.prototype);
SVG_Costume.prototype.constructor = SVG_Costume;
SVG_Costume.uber = Costume.prototype;
@@ -6219,7 +6219,7 @@ SVG_Costume.prototype.shrinkToFit = function (extentPoint) {
// CostumeEditorMorph inherits from Morph:
-CostumeEditorMorph.prototype = new Morph();
+CostumeEditorMorph.prototype = Object.create(Morph.prototype);
CostumeEditorMorph.prototype.constructor = CostumeEditorMorph;
CostumeEditorMorph.uber = Morph.prototype;
@@ -6454,7 +6454,7 @@ Note.prototype.stop = function () {
// CellMorph inherits from BoxMorph:
-CellMorph.prototype = new BoxMorph();
+CellMorph.prototype = Object.create(BoxMorph.prototype);
CellMorph.prototype.constructor = CellMorph;
CellMorph.uber = BoxMorph.prototype;
@@ -6794,7 +6794,7 @@ CellMorph.prototype.mouseClickLeft = function (pos) {
// WatcherMorph inherits from BoxMorph:
-WatcherMorph.prototype = new BoxMorph();
+WatcherMorph.prototype = Object.create(BoxMorph.prototype);
WatcherMorph.prototype.constructor = WatcherMorph;
WatcherMorph.uber = BoxMorph.prototype;
@@ -7281,7 +7281,7 @@ WatcherMorph.prototype.drawNew = function () {
// StagePrompterMorph inherits from BoxMorph:
-StagePrompterMorph.prototype = new BoxMorph();
+StagePrompterMorph.prototype = Object.create(BoxMorph.prototype);
StagePrompterMorph.prototype.constructor = StagePrompterMorph;
StagePrompterMorph.uber = BoxMorph.prototype;