Skip to content

Commit

Permalink
Merge pull request #42 from Trakkasure/bugfix/fix-close-channel
Browse files Browse the repository at this point in the history
Fixed #27. Added Connection.connected for #41
  • Loading branch information
Trakkasure authored Aug 20, 2017
2 parents 3543fc3 + 93c0cca commit 486e72c
Show file tree
Hide file tree
Showing 9 changed files with 509 additions and 259 deletions.
16 changes: 8 additions & 8 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"sourceMaps": false,
"presets": ['es2015','stage-1']
, "plugins": [
["transform-replace-object-assign", "simple-assign"]
, "transform-dev-warning"
, "add-module-exports"
, "transform-decorators-legacy"
, "transform-private-properties"
]
"presets": ['es2015','stage-1']
, "plugins": [
["transform-replace-object-assign", "simple-assign"]
, "transform-dev-warning"
, "add-module-exports"
, "transform-decorators-legacy"
, "transform-private-properties"
]
}
23 changes: 23 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"rules": {
"no-const-assign": "warn",
"no-this-before-super": "warn",
"no-undef": "warn",
"no-unreachable": "warn",
"no-unused-vars": "warn",
"constructor-super": "warn",
"valid-typeof": "warn"
}
}
32 changes: 32 additions & 0 deletions examples/simpleWrite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

var MikroNode = require('../src');
// Create API instance to a host.
var device = new MikroNode('10.10.10.10');
device.setDebug(MikroNode.DEBUG);

// Connect to MikroTik device
device.connect('admin','password').then(conn=>{
// When all channels are marked done, close the connection.
console.log('connected');

conn.closeOnDone(true);

var channel1=conn.openChannel();
channel1.closeOnDone(true);

console.log('going write 1');

// get only a count of the addresses.
channel1.write('/interface/set',{
'name':'ether1',
'disabled': 'yes'
}).then(data=>{
console.log("Done");
}).catch(error=>{
console.log("Error result ",error);
});
console.log('Wrote');
}
).catch(error=>{
console.log("Error logging in ",error);
});
Loading

0 comments on commit 486e72c

Please sign in to comment.