Skip to content

Commit 7eff00c

Browse files
authored
Create localstorage.js
1 parent eb7ae05 commit 7eff00c

1 file changed

Lines changed: 119 additions & 0 deletions

File tree

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// localstorage_set
2+
Blockly.Blocks['localstorage_set'] = {
3+
init: function() {
4+
5+
this.appendValueInput("KEY")
6+
.setCheck("String")
7+
.appendField(APPENDFIELD[lang].localstorage_set_1);
8+
9+
this.appendValueInput("VALUE")
10+
.appendField(APPENDFIELD[lang].localstorage_set_2);
11+
12+
this.appendDummyInput()
13+
.appendField(APPENDFIELD[lang].localstorage_set_3);
14+
15+
this.setPreviousStatement(true, null);
16+
this.setNextStatement(true, null);
17+
18+
this.setColour(70);
19+
20+
this.setTooltip(TOOLTIP[lang].localstorage_set);
21+
}
22+
};
23+
24+
// localstorage_get
25+
Blockly.Blocks['localstorage_get'] = {
26+
init: function() {
27+
this.appendValueInput("KEY")
28+
.setCheck("String")
29+
.appendField(APPENDFIELD[lang].localstorage_get);
30+
31+
this.setOutput(true, "String");
32+
this.setColour(70);
33+
this.setTooltip(TOOLTIP[lang].localstorage_get);
34+
}
35+
};
36+
37+
// localstorage_remove
38+
Blockly.Blocks['localstorage_remove'] = {
39+
init: function() {
40+
this.appendValueInput("KEY")
41+
.setCheck("String")
42+
.appendField(APPENDFIELD[lang].localstorage_remove);
43+
44+
this.setPreviousStatement(true, null);
45+
this.setNextStatement(true, null);
46+
this.setColour(70);
47+
this.setTooltip(TOOLTIP[lang].localstorage_remove);
48+
}
49+
};
50+
51+
// localstorage_clear
52+
Blockly.Blocks['localstorage_clear'] = {
53+
init: function() {
54+
this.appendDummyInput()
55+
.appendField(APPENDFIELD[lang].localstorage_clear);
56+
57+
this.setPreviousStatement(true, null);
58+
this.setNextStatement(true, null);
59+
this.setColour(70);
60+
this.setTooltip(TOOLTIP[lang].localstorage_clear);
61+
}
62+
};
63+
64+
// localstorage_length
65+
Blockly.Blocks['localstorage_length'] = {
66+
init: function() {
67+
68+
this.appendDummyInput()
69+
.appendField(APPENDFIELD[lang].localstorage_length);
70+
71+
this.setOutput(true, null);
72+
73+
this.setColour(70);
74+
75+
this.setTooltip(TOOLTIP[lang].localstorage_length);
76+
}
77+
};
78+
79+
// localstorage_index
80+
Blockly.Blocks['localstorage_index'] = {
81+
init: function() {
82+
83+
this.appendDummyInput()
84+
.appendField(APPENDFIELD[lang].localstorage_index);
85+
86+
this.appendValueInput("INDEX")
87+
.setCheck("Number");
88+
89+
this.appendDummyInput()
90+
.appendField(APPENDFIELD[lang].localstorage_index_1);
91+
92+
this.setOutput(true, "String");
93+
94+
this.setColour(70);
95+
96+
this.setTooltip(TOOLTIP[lang].localstorage_index);
97+
}
98+
};
99+
100+
// localstorage_is_have
101+
Blockly.Blocks['localstorage_is_have'] = {
102+
init: function() {
103+
104+
this.appendDummyInput()
105+
.appendField(APPENDFIELD[lang].localstorage_is_have);
106+
107+
this.appendValueInput("KEY")
108+
.setCheck("String");
109+
110+
this.appendDummyInput()
111+
.appendField(APPENDFIELD[lang].localstorage_is_have_1);
112+
113+
this.setOutput(true, "Boolean");
114+
115+
this.setColour(70);
116+
117+
this.setTooltip(TOOLTIP[lang].localstorage_is_have);
118+
}
119+
};

0 commit comments

Comments
 (0)