Skip to content
Snippets Groups Projects
Commit 8bd6c6ce authored by nanocryk's avatar nanocryk
Browse files

feature : max certs

parent 71dbd14c
No related branches found
No related tags found
No related merge requests found
...@@ -2,15 +2,19 @@ let WebOfTrust = require('../native').WebOfTrust; ...@@ -2,15 +2,19 @@ let WebOfTrust = require('../native').WebOfTrust;
{ {
let wot = new WebOfTrust(3); let wot = new WebOfTrust(3);
console.log(wot.add_node()); console.log(wot.getMaxCert())
console.log(wot.size()) wot.setMaxCert(4);
console.log(wot.getMaxCert())
console.log(wot.addNode());
console.log(wot.getWoTSize())
} }
console.log("-----")
{ {
let wot = new WebOfTrust("hey.wot"); let wot = new WebOfTrust("hey.wot");
console.log(wot.getMaxCert())
console.log("Hello, world !"); console.log(wot.addNode());
console.log(wot.add_node()); console.log(wot.getWoTSize());
console.log(wot.size()); console.log(wot.toFile("hey.wot"));
console.log(wot.to_file("hey.wot"));
} }
...@@ -247,6 +247,28 @@ declare_types! { ...@@ -247,6 +247,28 @@ declare_types! {
None => Err(Throw), None => Err(Throw),
} }
} }
method setMaxCert(call) {
let scope = call.scope;
let max_cert = try!(try!(call.arguments.require(scope, 0)).check::<JsInteger>()).value() as usize;
call.arguments.this(scope).grab(|wot| {
wot.max_cert = max_cert;
});
Ok(JsObject::new(scope).upcast())
}
method getMaxCert(call) {
let scope = call.scope;
let max_cert = call.arguments.this(scope).grab(|wot| {
wot.max_cert
});
Ok(JsInteger::new(scope, max_cert as i32).upcast())
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment