@arcticnotes/node-wsh 0.0.8 → 0.0.9

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.
@@ -86,6 +86,18 @@ class Proxies {
86
86
  default: throw new Error( `unknown status: ${ output[ 0]}`);
87
87
  }
88
88
  },
89
+
90
+ set( target, prop, value) {
91
+ const encodedTarget = this.proxies.#encode( target[ PROXY]);
92
+ const encodedProp = this.proxies.#encode( prop);
93
+ const encodedValue = this.proxies.#encode( value);
94
+ const output = JSON.parse( this.proxies.#syncline.exchange( JSON.stringify( [ 'set', encodedTarget, encodedProp, encodedValue])));
95
+ switch( output[ 0]) {
96
+ case 'set': return;
97
+ case 'error': throw new Error( output[ 1]);
98
+ default: throw new Error( `unknown status: ${ output[ 0]}`);
99
+ }
100
+ },
89
101
  };
90
102
 
91
103
  #functionHandler = {
package/lib/wsh/host.js CHANGED
@@ -138,6 +138,7 @@ function decodePotentialMethod( encoded) {
138
138
  var output;
139
139
  var target;
140
140
  var prop;
141
+ var value;
141
142
  var thisArg;
142
143
  var args;
143
144
  while( !WScript.StdIn.AtEndOfLine)
@@ -162,6 +163,13 @@ function decodePotentialMethod( encoded) {
162
163
  output = [ 'value', encodePotentialMethod( target, prop)];
163
164
  }
164
165
  break;
166
+ case 'set': // [ 'set', target, prop, value] => [ 'set']
167
+ target = decode( input[ 1]);
168
+ prop = decode( input[ 2]);
169
+ value = decode( input[ 3]);
170
+ target[ prop] = value;
171
+ output = [ 'set'];
172
+ break;
165
173
  case 'apply': // [ 'apply', target, thisArg, argumentList] => [ 'value', value]
166
174
  target = decodePotentialMethod( input[ 1]);
167
175
  thisArg = decode( input[ 2]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcticnotes/node-wsh",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "A Node.js package that runs Windows Scripting Host (WSH) as a child process and exposes the resources from the WSH world to the Node.js world",
5
5
  "author": "Paul <paul@arcticnotes.com>",
6
6
  "license": "MIT",