Comparing version 0.4.6 to 0.4.10
{ | ||
"name": "jjjrmi", | ||
"version": "0.4.6", | ||
"version": "0.4.10", | ||
"keywords": [ | ||
@@ -13,5 +13,3 @@ "util", | ||
"contributors": [], | ||
"dependencies": { | ||
"rootpath": "^0.1.2" | ||
}, | ||
"dependencies": {}, | ||
"main": "./src/JJJRMISocket.js", | ||
@@ -22,5 +20,5 @@ "files": [ | ||
"scripts": { | ||
"cp": "copyfiles -f ../JJJRMI/dist/jjjrmi.partial.js src", | ||
"pack-js": "npm pack" | ||
"cp": "copyfiles -f ../JJJRMI/dist/gen/* src/gen", | ||
"build-js": "browserify ./src/main.js -o ./dist/jjjrmi.packed.js -d" | ||
} | ||
} |
@@ -44,2 +44,5 @@ let Constants = require("./Constants"); | ||
this.translator.notifyDecode(newInstance); | ||
if (typeof newInstance.jjjOnDecode === "function"){ | ||
newInstance.jjjOnDecode(); | ||
} | ||
return newInstance; | ||
@@ -63,3 +66,3 @@ } | ||
} | ||
; | ||
class RestoredArray { | ||
@@ -82,3 +85,3 @@ constructor(json, translator) { | ||
} | ||
; | ||
class Decoder { | ||
@@ -121,3 +124,3 @@ constructor(json, translator) { | ||
} | ||
; | ||
module.exports = Decoder; |
@@ -1,4 +0,2 @@ | ||
/* global Symbol */ | ||
ArrayList = class ArrayList { | ||
let ArrayList = class ArrayList { | ||
constructor() { | ||
@@ -5,0 +3,0 @@ this.elementData = []; |
@@ -1,4 +0,2 @@ | ||
/* global Symbol */ | ||
HashMap = class HashMap { | ||
let HashMap = class HashMap { | ||
constructor() { | ||
@@ -5,0 +3,0 @@ this.map = new Map(); |
@@ -1,7 +0,5 @@ | ||
/* global JJJMessageType */ | ||
let Translator = require("./Translator"); | ||
let jjjrmi = require("./jjjrmi.partial"); | ||
let jjjrmi = require("./gen/package"); | ||
let ArrayList = require("./java-equiv/ArrayList"); | ||
let HashMap = require("./java-equiv/HashMap"); | ||
Console = console; | ||
@@ -22,11 +20,11 @@ class JJJRMISocket { | ||
getHandler(aClass) { | ||
return this.translator.getHandler(aClass); | ||
} | ||
hasHandler(aClass) { | ||
return this.translator.hasHandler(aClass); | ||
} | ||
setHandler(aClass, handler) { | ||
this.translator.setHandler(aClass, handler); | ||
} | ||
getHandler(aClass) { | ||
return this.translator.getHandler(aClass); | ||
} | ||
hasHandler(aClass) { | ||
return this.translator.hasHandler(aClass); | ||
} | ||
setHandler(aClass, handler) { | ||
this.translator.setHandler(aClass, handler); | ||
} | ||
@@ -91,3 +89,3 @@ async connect(url) { | ||
}; | ||
let packet = new MethodRequest(uid, ptr, methodName, argsArray); | ||
let packet = new jjjrmi.MethodRequest(uid, ptr, methodName, argsArray); | ||
let encodedPacket = this.translator.encode(packet); | ||
@@ -190,3 +188,3 @@ if (this.flags.SENT) console.log(encodedPacket); | ||
RECEIVED: false, /* show the received server object, verbose shows the json text as well */ | ||
VERBOSE: false, | ||
VERBOSE: false, /* print raw text for SENT / RECEIVED */ | ||
ONREGISTER: false /* report classes as they are registered */ | ||
@@ -198,6 +196,20 @@ }; | ||
JJJRMISocket.registerClass = function(aClass){ | ||
if (typeof aClass !== "function") throw new Error(`paramater 'class' of method 'registerClass' is '${typeof aClass.__getClass}', expected 'function'`); | ||
if (typeof aClass.__getClass !== "function") throw new Error(`in Class ${aClass.constructor.name} method __getClass of type ${typeof aClass.__getClass}`); | ||
if (typeof aClass !== "function"){ | ||
console.log(aClass); | ||
throw new Error(`paramater 'class' of method 'registerClass' is '${typeof aClass}', expected 'function'`); | ||
} | ||
if (typeof aClass.__getClass !== "function"){ | ||
throw new Error(`in Class ${aClass.constructor.name} method __getClass of type ${typeof aClass.__getClass}`); | ||
} | ||
if (JJJRMISocket.flags.ONREGISTER) console.log(`Register ${aClass.__getClass()}`); | ||
JJJRMISocket.classes.set(aClass.__getClass(), aClass); | ||
for (let field in aClass){ | ||
if (JJJRMISocket.flags.ONREGISTER && JJJRMISocket.flags.VERBOSE) console.log(`considering ${aClass.__getClass()}.${field}`); | ||
if (typeof aClass[field] === "function" && typeof aClass[field].__getClass === "function"){ | ||
JJJRMISocket.registerClass(aClass[field]); | ||
} | ||
} | ||
}; | ||
@@ -207,3 +219,5 @@ | ||
JJJRMISocket.registerPackage = function(package){ | ||
for (let aClass in package) JJJRMISocket.registerClass(package[aClass]); | ||
for (let aClass in package){ | ||
JJJRMISocket.registerClass(package[aClass]); | ||
} | ||
}; | ||
@@ -210,0 +224,0 @@ |
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
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
43830
0
22
1216
21
- Removedrootpath@^0.1.2
- Removedrootpath@0.1.2(transitive)