Comparing version 2.4.0 to 3.0.0
@@ -83,2 +83,19 @@ | ||
/** | ||
* Define a new Tcl command which will call a JavaScript function. | ||
* | ||
* @param {string} cmd - New Tcl procedure name | ||
* @param {JS~cmdCallback} - JS space callback function to call | ||
*/ | ||
Tcl.prototype.proc = function ( cmd, callback ) { | ||
try { | ||
return new Result( this._binding.proc( cmd, callback ), this._binding ); | ||
} catch ( e ) { | ||
throw e; | ||
} | ||
}; | ||
/** | ||
* Alias for {@link Tcl#cmdSync} | ||
@@ -150,3 +167,3 @@ * | ||
this._binding.queue( cmd, function ( err, data ) { | ||
this._binding.queue( cmd, ( err, data ) => { | ||
@@ -153,0 +170,0 @@ var result = null; |
{ | ||
"name": "tcl", | ||
"version": "2.4.0", | ||
"version": "3.0.0", | ||
"description": "Node.js Tcl binding", | ||
@@ -11,8 +11,6 @@ "main": "index.js", | ||
"scripts": { | ||
"coverage": "istanbul cover _mocha -- --reporter spec", | ||
"coverage:lcovonly": "istanbul cover _mocha --report lcovonly -- --reporter spec", | ||
"coveralls": "cat ./coverage/lcov.info | coveralls", | ||
"coverage": "nyc --reporter=html --reporter=text-summary mocha", | ||
"coverage:ci": "nyc --reporter=lcovonly --reporter=text-summary mocha", | ||
"docs": "jsdoc -c jsdoc-conf.json ./README.md", | ||
"lint": "jshint index.js lib test", | ||
"precoveralls": "npm run coverage:lcovonly", | ||
"test": "mocha" | ||
@@ -38,13 +36,12 @@ }, | ||
"dependencies": { | ||
"bindings": "^1.3.0", | ||
"nan": "^2.7.0" | ||
"bindings": "^1.5.0", | ||
"node-addon-api": "^4.2.0" | ||
}, | ||
"devDependencies": { | ||
"chai": "^4.1.2", | ||
"coveralls": "^3.0.0", | ||
"istanbul": "^0.4.5", | ||
"jshint": "^2.9.5", | ||
"mocha": "^4.0.1", | ||
"mocha": "^9.2.0", | ||
"nyc": "^15.1.0", | ||
"sinon": "^4.1.1" | ||
} | ||
} |
@@ -8,7 +8,7 @@ node-tcl | ||
[![Build Status](https://travis-ci.org/nukedzn/node-tcl.svg)](https://travis-ci.org/nukedzn/node-tcl) | ||
[![Coverage Status](https://coveralls.io/repos/nukedzn/node-tcl/badge.svg)](https://coveralls.io/r/nukedzn/node-tcl) | ||
[![Dependency Status](https://david-dm.org/nukedzn/node-tcl.svg)](https://david-dm.org/nukedzn/node-tcl) | ||
[![devDependency Status](https://david-dm.org/nukedzn/node-tcl/dev-status.svg)](https://david-dm.org/nukedzn/node-tcl#info=devDependencies) | ||
[![codecov](https://codecov.io/gh/nukedzn/node-tcl/branch/master/graph/badge.svg?token=AAhVnMCHcn)](https://codecov.io/gh/nukedzn/node-tcl) | ||
Node.js Tcl bindings to execute Tcl commands using a native Tcl Interpreter. | ||
Provides Node.js bindings to execute Tcl commands using a native Tcl Interpreter. | ||
Also includes the ability to define new commands in the Tcl intepretor that will invoke a | ||
specified JavaScript function. | ||
@@ -25,2 +25,6 @@ | ||
This version has been updated to use [node-addon-api](https://github.com/nodejs/node-addon-api) | ||
and so should be compatible with future versions of node.js. Unfortunately, it may not build | ||
properly on very old node.js versions. | ||
### Optional Dependencies | ||
@@ -164,3 +168,28 @@ | ||
### proc( cmd, callback ) | ||
Instructs the Tcl interpreter to create a new command: cmd. | ||
When this new command is encountered at any time during the life of the interpreter, | ||
the specified callback will be invoked with whatever parameters were supplied to cmd. | ||
There is currently not a command for deleting commands from the interpreter. | ||
#### Parameters | ||
| Name | Type | Description | | ||
|----------|--------|---------------------------| | ||
| cmd | String | New Tcl command to create | | ||
| callback | [Callback](http://nukedzn.github.io/node-tcl/docs/Tcl.html#~cmdCallback) | Callback method to handle the command | | ||
#### Example | ||
``` js | ||
tcl.proc( 'newTclCmd', function ( arg1, arg2 ) { | ||
console.log( 'Got', arg1, arg2 ); // Got some arguments | ||
} ); | ||
tcl.cmdSync( 'newTclCmd some arguments' ); | ||
``` | ||
## API Documentation | ||
@@ -167,0 +196,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26062
5
232
201
2
+ Addednode-addon-api@^4.2.0
+ Addednode-addon-api@4.3.0(transitive)
- Removednan@^2.7.0
- Removednan@2.22.0(transitive)
Updatedbindings@^1.5.0