Skip to content

Commit

Permalink
Merge pull request #449 from entrylabs/hotfix/function-schema-init
Browse files Browse the repository at this point in the history
bug fix
  • Loading branch information
chanlee authored Aug 18, 2016
2 parents 94342fd + f56cec5 commit 2a6496d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 26 deletions.
25 changes: 15 additions & 10 deletions dist/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT:
c = c.tagName.toUpperCase();
!a.isEditing || "INPUT" === c && b || a.editObjectValues(!1);
}
}, generateFunctionSchema:function(b) {
b = "func_" + b;
if (!Entry.block[b]) {
var a = function() {
};
a.prototype = Entry.block.function_general;
a = new a;
a.changeEvent = new Entry.Event;
a.template = Lang.template.function_general;
Entry.block[b] = a;
}
}};
window.Entry = Entry;
Entry.Albert = {PORT_MAP:{leftWheel:0, rightWheel:0, buzzer:0, leftEye:0, rightEye:0, note:0, bodyLed:0, frontLed:0, padWidth:0, padHeight:0}, setZero:function() {
Expand Down Expand Up @@ -12238,17 +12249,11 @@ Entry.Func = function(b) {
this.blockMenuBlock = this.block = null;
this.hashMap = {};
this.paramMap = {};
var a = function() {
};
a.prototype = Entry.block.function_general;
a = new a;
a.changeEvent = new Entry.Event;
a.template = Lang.template.function_general;
Entry.block["func_" + this.id] = a;
Entry.generateFunctionSchema(this.id);
if (b) {
b = this.content._blockMap;
for (var c in b) {
Entry.Func.registerParamBlock(b[c].type);
for (var a in b) {
Entry.Func.registerParamBlock(b[a].type);
}
Entry.Func.generateWsBlock(this);
}
Expand Down Expand Up @@ -13886,7 +13891,7 @@ Entry.VariableContainer.prototype.setVariables = function(b) {
};
Entry.VariableContainer.prototype.setFunctions = function(b) {
b && b.forEach(function(a) {
Entry.block["func_" + a.id] = !0;
Entry.generateFunctionSchema(a.id);
});
for (var a in b) {
var c = new Entry.Func(b[a]);
Expand Down
15 changes: 8 additions & 7 deletions dist/entry.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions src/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,5 +340,17 @@ Entry.cancelObjectEdit = function(e) {
object.editObjectValues(false);
};

Entry.generateFunctionSchema = function(functionId) {
functionId = 'func_' + functionId;
if (Entry.block[functionId]) return;
var blockSchema = function () {};
var blockPrototype = Entry.block.function_general;
blockSchema.prototype = blockPrototype;
blockSchema = new blockSchema();
blockSchema.changeEvent = new Entry.Event();
blockSchema.template = Lang.template.function_general;

Entry.block[functionId] = blockSchema;
};

window.Entry = Entry;
9 changes: 1 addition & 8 deletions src/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,7 @@ Entry.Func = function(func) {

this.paramMap = {};

var blockSchema = function () {};
var blockPrototype = Entry.block.function_general;
blockSchema.prototype = blockPrototype;
blockSchema = new blockSchema();
blockSchema.changeEvent = new Entry.Event();
blockSchema.template = Lang.template.function_general;

Entry.block["func_" + this.id] = blockSchema;
Entry.generateFunctionSchema(this.id);

if (func) {
var blockMap = this.content._blockMap;
Expand Down
2 changes: 1 addition & 1 deletion src/variable_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ Entry.VariableContainer.prototype.setVariables = function(variables) {
Entry.VariableContainer.prototype.setFunctions = function(functions) {
if (functions) {
functions.forEach(function(f) {
Entry.block['func_' + f.id] = true;
Entry.generateFunctionSchema(f.id);
});
}

Expand Down

0 comments on commit 2a6496d

Please sign in to comment.