trac-peer 0.1.30 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/contract.js +4 -1
- package/src/index.js +0 -1
package/package.json
CHANGED
package/src/contract.js
CHANGED
|
@@ -146,15 +146,18 @@ class Contract {
|
|
|
146
146
|
return result === true;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
addFunction(type){
|
|
150
|
+
if(this.features[type] !== undefined || this.schemata[type] !== undefined) throw new Error('addFunction(type): The type has been registered already.');
|
|
150
151
|
this.funcs[type] = true;
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
addSchema(type, schema){
|
|
155
|
+
if(this.funcs[type] !== undefined || this.features[type] !== undefined) throw new Error('addSchema(type, schema): The type has been registered already.');
|
|
154
156
|
this.schemata[type] = this.protocol.peer.check.validator.compile(schema);
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
addFeature(type, func) {
|
|
160
|
+
if(this.funcs[type] !== undefined || this.schemata[type] !== undefined) throw new Error('addFeature(type, func): The type has been registered already.');
|
|
158
161
|
this.features[type] = func;
|
|
159
162
|
}
|
|
160
163
|
|
package/src/index.js
CHANGED
|
@@ -46,7 +46,6 @@ export class Peer extends ReadyResource {
|
|
|
46
46
|
this.protocol_instance = null;
|
|
47
47
|
this.contract_instance = null;
|
|
48
48
|
this.channel = b4a.alloc(32).fill(options.channel) || null;
|
|
49
|
-
this.tx_channel = b4a.alloc(32).fill(options.tx_channel) || null;
|
|
50
49
|
this.bee = null;
|
|
51
50
|
this.replicate = options.replicate !== false;
|
|
52
51
|
this.connectedNodes = 1;
|