Skip to content

Commit bb2d1f5

Browse files
author
ColinTree
committed
0.3.2: deprecate "arg" and recommend "param" instead
1 parent fe5b57a commit bb2d1f5

File tree

4 files changed

+12
-15
lines changed

4 files changed

+12
-15
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ e.g.
3838
# test
3939
---
4040

41-
{% Ai2Method %}{"name":"MethodName", "componentName":"compName1", "arg":["arg1","arg2"]}{% endAi2Method %}
41+
{% Ai2Method %}{"name":"MethodName", "componentName":"compName1", "param":["param1","param2"]}{% endAi2Method %}
4242

43-
{% Ai2Method %}{"name":"MethodName2", "arg":["arg1","arg2"], "output":true}{% endAi2Method %}
43+
{% Ai2Method %}{"name":"MethodName2", "param":["param1","param2"], "output":true}{% endAi2Method %}
4444

45-
{% Ai2Method %}{"name":"MethodName2", "arg":["arg1","arg2"], "output":true, "scale":0.9}{% endAi2Method %}
45+
{% Ai2Method %}{"name":"MethodName2", "param":["param1","param2"], "output":true, "scale":0.9}{% endAi2Method %}
4646

47-
{% Ai2Event %}{"name":"EventName", "componentName":"compName2", "arg":["arg1","arg2"]}{% endAi2Event %}
47+
{% Ai2Event %}{"name":"EventName", "componentName":"compName2", "param":["param1","param2"]}{% endAi2Event %}
4848

4949
{% Ai2Property %}{"name":"PropertyName", "componentName":"compName3", "getter":true}{% endAi2Property %}
5050

assets/plugin.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ require(['gitbook', 'jQuery'], function(gitbook, $) {
3232
var block = getBlock(decodeURI($(this).attr("value")));
3333

3434
var name = block['name'];
35-
var arg = block['arg'] || [];
35+
var param = block['param'] || block['arg'] || [];
3636
var output = block['output']===true;
3737
var scale = block['scale'] || SCALE_LEVEL;
3838

@@ -41,8 +41,8 @@ require(['gitbook', 'jQuery'], function(gitbook, $) {
4141
Blockly.Blocks['dynamicCreated_'+blockId] = {
4242
init: function() {
4343
this.appendDummyInput().appendField(TEXT_CALL).appendField(new Blockly.FieldDropdown([[ComponentName, 'OPTIONNAME']]), 'COMPONENT_SELECTOR').appendField('.'+name);
44-
for (var i=0; i<arg.length; i++) {
45-
this.appendValueInput('NAME').setAlign(Blockly.ALIGN_RIGHT).appendField(arg[i]);
44+
for (var i=0; i<param.length; i++) {
45+
this.appendValueInput('NAME').setAlign(Blockly.ALIGN_RIGHT).appendField(param[i]);
4646
}
4747
this.setInputsInline(false);
4848
if (output) {
@@ -65,18 +65,18 @@ require(['gitbook', 'jQuery'], function(gitbook, $) {
6565
var block = getBlock(decodeURI($(this).attr("value")));
6666

6767
var name = block['name'];
68-
var arg = block['arg'] || [];
68+
var param = block['param'] || block['arg'] || [];
6969
var scale = block['scale'] || SCALE_LEVEL;
7070

7171
$(this).attr('id', blockId).show();
7272

7373
Blockly.Blocks['dynamicCreated_'+blockId] = {
7474
init: function() {
7575
this.appendDummyInput('').appendField(TEXT_WHEN).appendField(new Blockly.FieldDropdown([[ComponentName, 'OPTIONNAME']]), "COMPONENT_SELECTOR").appendField('.' + name);
76-
if (arg.length > 0) {
76+
if (param.length > 0) {
7777
var paramInput = this.appendDummyInput('PARAMETERS').appendField(" ").setAlign(Blockly.ALIGN_LEFT);
78-
for (var i=0; i<arg.length; i++) {
79-
paramInput.appendField(new Blockly.FieldTextInput(arg[i]), 'VAR'+i).appendField(" ");
78+
for (var i=0; i<param.length; i++) {
79+
paramInput.appendField(new Blockly.FieldTextInput(param[i]), 'VAR'+i).appendField(" ");
8080
}
8181
}
8282
this.appendStatementInput("DO").appendField(TEXT_DO);

index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,16 @@ module.exports = {
55
js: ["blockly_compressed.js", "plugin.js"]
66
},
77
blocks: {
8-
// "{% Ai2Method %}{"name":"MethodName", "componentName":"ComponentName", "arg":["arg1","arg2"]}{% endAi2Method %}"
98
Ai2Method: {
109
process: function(blk) {
1110
return "<div ai2-method value=\""+encodeURI(blk.body)+"\"></div>";
1211
}
1312
},
14-
// "{% Ai2Event %}{"name":"EventName", "componentName":"ComponentName", "arg":["arg1","arg2"]}{% endAi2Event %}"
1513
Ai2Event: {
1614
process: function(blk) {
1715
return "<div ai2-event value=\""+encodeURI(blk.body)+"\"></div>";
1816
}
1917
},
20-
// "{% Ai2Property %}{"name":"PropertyName", "componentName":"ComponentName", "getter":true|false}{% endAi2Property %}"
2118
Ai2Property: {
2219
process: function(blk) {
2320
return "<div ai2-property value=\""+encodeURI(blk.body)+"\"></div>";

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@
5050
"type": "git",
5151
"url": "git+https://github.com/ColinTree/gitbook-plugin-ai2-blocks.git"
5252
},
53-
"version": "0.3.1"
53+
"version": "0.3.2"
5454
}

0 commit comments

Comments
 (0)