Skip to content

Commit

Permalink
remove when schema is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
SeonMyungLim committed Aug 19, 2016
1 parent cef6996 commit 738b6f4
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 80 deletions.
98 changes: 54 additions & 44 deletions dist/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -13920,10 +13920,15 @@ Entry.VariableContainer.prototype.createFunction = function() {
Entry.VariableContainer.prototype.addFunction = function(b) {
};
Entry.VariableContainer.prototype.removeFunction = function(b) {
b = b.id;
var a = this.functions_;
a[b].destroy();
delete a[b];
var a = b.id;
b = this.functions_;
b[a].destroy();
delete b[a];
a = "func_" + a;
Entry.container.removeFuncBlocks(a);
for (var c in b) {
b[c].content.removeBlocksByType(a);
}
this.updateList();
};
Entry.VariableContainer.prototype.checkListPosition = function(b, a) {
Expand Down Expand Up @@ -15855,6 +15860,7 @@ Entry.BlockMenuScroller.RADIUS = 7;
};
})(Entry.BlockMenuScroller.prototype);
Entry.BlockView = function(b, a, c) {
var d = this;
Entry.Model(this, !1);
this.block = b;
this._lazyUpdatePos = _.debounce(b._updatePos.bind(b), 200);
Expand All @@ -15863,39 +15869,42 @@ Entry.BlockView = function(b, a, c) {
this.set(b);
this.svgGroup = a.svgBlockGroup.elem("g");
this._schema = Entry.block[b.type];
this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema));
var d = this._skeleton = Entry.skeleton[this._schema.skeleton];
this._contents = [];
this._statements = [];
this.magnet = {};
this._paramMap = {};
d.magnets && d.magnets(this).next && (this.svgGroup.nextMagnet = this.block, this._nextGroup = this.svgGroup.elem("g"), this._observers.push(this.observe(this, "_updateMagnet", ["contentHeight"])));
this.isInBlockMenu = this.getBoard() instanceof Entry.BlockMenu;
var e = this;
this.mouseHandler = function() {
var a = e.block.events;
a && a.mousedown && a.mousedown.forEach(function(a) {
a(e);
if (void 0 === this._schema) {
this.block.destroy(!1, !1);
} else {
this._schema.changeEvent && (this._schemaChangeEvent = this._schema.changeEvent.attach(this, this._updateSchema));
var e = this._skeleton = Entry.skeleton[this._schema.skeleton];
this._contents = [];
this._statements = [];
this.magnet = {};
this._paramMap = {};
e.magnets && e.magnets(this).next && (this.svgGroup.nextMagnet = this.block, this._nextGroup = this.svgGroup.elem("g"), this._observers.push(this.observe(this, "_updateMagnet", ["contentHeight"])));
this.isInBlockMenu = this.getBoard() instanceof Entry.BlockMenu;
this.mouseHandler = function() {
var a = d.block.events;
a && a.mousedown && a.mousedown.forEach(function(a) {
a(d);
});
d.onMouseDown.apply(d, arguments);
};
this._startRender(b, c);
this._observers.push(this.block.observe(this, "_setMovable", ["movable"]));
this._observers.push(this.block.observe(this, "_setReadOnly", ["movable"]));
this._observers.push(this.block.observe(this, "_setCopyable", ["copyable"]));
this._observers.push(this.block.observe(this, "_updateColor", ["deletable"], !1));
this._observers.push(this.observe(this, "_updateBG", ["magneting"], !1));
this._observers.push(this.observe(this, "_updateOpacity", ["visible"], !1));
this._observers.push(this.observe(this, "_updateDisplay", ["display"], !1));
this._observers.push(this.observe(this, "_updateShadow", ["shadow"]));
this._observers.push(this.observe(this, "_updateMagnet", ["offsetY"]));
this._observers.push(a.code.observe(this, "_setBoard", ["board"], !1));
this.dragMode = Entry.DRAG_MODE_NONE;
Entry.Utils.disableContextmenu(this.svgGroup.node);
a = b.events.viewAdd;
"workspace" == Entry.type && a && !this.isInBlockMenu && a.forEach(function(a) {
Entry.Utils.isFunction(a) && a(b);
});
e.onMouseDown.apply(e, arguments);
};
this._startRender(b, c);
this._observers.push(this.block.observe(this, "_setMovable", ["movable"]));
this._observers.push(this.block.observe(this, "_setReadOnly", ["movable"]));
this._observers.push(this.block.observe(this, "_setCopyable", ["copyable"]));
this._observers.push(this.block.observe(this, "_updateColor", ["deletable"], !1));
this._observers.push(this.observe(this, "_updateBG", ["magneting"], !1));
this._observers.push(this.observe(this, "_updateOpacity", ["visible"], !1));
this._observers.push(this.observe(this, "_updateDisplay", ["display"], !1));
this._observers.push(this.observe(this, "_updateShadow", ["shadow"]));
this._observers.push(this.observe(this, "_updateMagnet", ["offsetY"]));
this._observers.push(a.code.observe(this, "_setBoard", ["board"], !1));
this.dragMode = Entry.DRAG_MODE_NONE;
Entry.Utils.disableContextmenu(this.svgGroup.node);
a = b.events.viewAdd;
"workspace" == Entry.type && a && !this.isInBlockMenu && a.forEach(function(a) {
Entry.Utils.isFunction(a) && a(b);
});
}
};
Entry.BlockView.PARAM_SPACE = 5;
Entry.BlockView.DRAG_RADIUS = 5;
Expand Down Expand Up @@ -16724,14 +16733,15 @@ Entry.Executor = function(b, a) {
for (;;) {
var a = null;
try {
a = this.scope.block.getSchema().func.call(this.scope, this.entity, this.scope);
} catch (b) {
if ("AsyncError" === b.name) {
var b = this.scope.block.getSchema();
b && (a = b.func.call(this.scope, this.entity, this.scope));
} catch (e) {
if ("AsyncError" === e.name) {
a = Entry.STATIC.BREAK;
} else {
var c = !1;
"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec" != b.message && (c = !0);
Entry.Utils.stopProjectWithToast(this.scope, "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec", c);
var d = !1;
"\ub7f0\ud0c0\uc784 \uc5d0\ub7ec" != e.message && (d = !0);
Entry.Utils.stopProjectWithToast(this.scope, "\ub7f0\ud0c0\uc784 \uc5d0\ub7ec", d);
}
}
if (this.isEnd()) {
Expand Down Expand Up @@ -18886,7 +18896,7 @@ Entry.Thread = function(b, a, c) {
};
b.createView = function(a, b) {
this.view || (this.view = new Entry.ThreadView(this, a));
this._data.map(function(d) {
this._data.getAll().forEach(function(d) {
d.createView(a, b);
});
};
Expand Down Expand Up @@ -19161,7 +19171,7 @@ Entry.Block.DELETABLE_FALSE_LIGHTEN = 3;
f = this.getNextBlock();
this.getCode().unregisterBlock(this);
e = this.getThread();
this._schema.event && e.unregisterEvent(this, this._schema.event);
this._schema && this._schema.event && e.unregisterEvent(this, this._schema.event);
f && (b ? f.destroy(a, b) : g ? f.view && f.view.bindPrev(g) : (g = this.getThread().view.getParent(), g.constructor === Entry.FieldStatement ? (f.view && f.view.bindPrev(g), g.insertTopBlock(f)) : g.constructor === Entry.FieldStatement ? f.replace(g._valueBlock) : f.view._toGlobalCoordinate()));
!this.doNotSplice && e.spliceBlock ? e.spliceBlock(this) : delete this.doNotSplice;
this.view && this.view.destroy(a);
Expand Down
Loading

0 comments on commit 738b6f4

Please sign in to comment.