#1 Re: SyNode » Beta release of SyNode - ES6 JavaScript + NPM modules » 2017-08-29 13:03:45

Hi @mpv,
It's OK now!

I still think it's perfect to register over 255 functions for the defineClasses.
I have a few classes they have more than 255 functions.

how ever it's great now!

Thanks!

#2 Re: SyNode » Beta release of SyNode - ES6 JavaScript + NPM modules » 2017-08-27 09:03:15

Hi @mpv
I download the dlls from x32: https://unitybase.info/downloads/mozjs-45.zip
Then I define SM52 on the global level, and it can run now, but in the COM object it shows an error.
I used the  UBComBridge from @unitybase\com-bridge,

var dm = createobject("dm.dmsoft");
Log(dm.Ver());  

This code is ok with SM45, but in the SM52 it will show

dm.Ver is not a function .

.
Is there something wrong with SM52?

#3 Re: SyNode » Beta release of SyNode - ES6 JavaScript + NPM modules » 2017-02-08 04:10:48

I also want know how to clear the moudles loaded, I just used it Free every times and Create a New TSMEngine...

#6 Re: SyNode » Beta release of SyNode - ES6 JavaScript + NPM modules » 2017-02-02 13:30:20

@mpv:
Thanks for your help!

I download some lib from http://registry.unitybase.info
@unitybase/stubs and @unitybase/base etc..
but they can't work well with SyNode, is there any thing I need change?
example: when I use http.get("http://www.xxx.com"); it will show _http.writeEnd is not a function,
I have defineClasses THTTPClient but the THTTPClient not have the "writeEnd" method.

#8 Re: mORMot 1 » In SyNode can't register a Class with the methods more than 255. » 2017-02-01 12:24:10

Ok, Thank you!
I can't modify the COM, it is theothers,
So I must modify the CallFunction.
Thank you again!

The other question, where can I download more nodejs lib?

#9 Re: mORMot 1 » In SyNode can't register a Class with the methods more than 255. » 2017-02-01 10:11:10

@mpv:
Very thanks!
But I have a problem with the var out parameters, like:

function GetClientSize(hwnd: Integer; out width: OleVariant; out height: OleVariant): Integer;

I can't get the width and height with this function, can I get the param name from the js?
JS Code:

var width = 0;
var height = 0;
var ret = com.GetClientSize(hwnd,width,height); 
//width and height  always 0 

#10 Re: mORMot 1 » In SyNode can't register a Class with the methods more than 255. » 2017-01-30 14:58:53

Ok,
  I want Register a COM DLL in JS, and I have import it, it have more than 300 methods,
Is there some idea I can Call the Mothods like:
var a = new TMyClass(); a.abc();

Thanks!

#11 mORMot 1 » In SyNode can't register a Class with the methods more than 255. » 2017-01-30 14:48:53

markzql
Replies: 8

Hi,

In SyNode defineClass can't register a Class with more than 255 methods?
  How can I register a Class with more than 255 methods?

The Code In SyNode.pas

/// Define a Delphi class as JS class (prototype), so it can be created via new:
    //    engine.defineClass(TmyObject, TSMNewRTTIProtoObject);
    //  and in JS
    //    var myObj = new TmyObject();
    // - Class will be exposed in the aParent javaScript object, if aParent is omitted - in the global object
    // - AProto parameter can be a TSMCustomProtoObject descendant (TSMSimpleRTTIProtoObject, TSMNewRTTIProtoObject)
    // WARNING - possible prototypes count is limited to 255 - JSCLASS_GLOBAL_SLOT_COUNT = 76 for SM45,
    //   so it is better to use a bindings, add where a native functions and wrap it in class into the JavaScript
    //   see `fs.js` for sample.
    function defineClass(AForClass: TClass; AProto: TSMCustomProtoObjectClass; aParent: PJSRootedObject = nil): TSMCustomProtoObject;

#12 Re: SyNode » Beta release of SyNode - ES6 JavaScript + NPM modules » 2017-01-30 14:46:50

Hi,

In SyNode defineClass can't register a Class with more than 255 methods?
  How can I register a Class with more than 255 methods?

The Code In SyNode.pas

/// Define a Delphi class as JS class (prototype), so it can be created via new:
    //    engine.defineClass(TmyObject, TSMNewRTTIProtoObject);
    //  and in JS
    //    var myObj = new TmyObject();
    // - Class will be exposed in the aParent javaScript object, if aParent is omitted - in the global object
    // - AProto parameter can be a TSMCustomProtoObject descendant (TSMSimpleRTTIProtoObject, TSMNewRTTIProtoObject)
    // WARNING - possible prototypes count is limited to 255 - JSCLASS_GLOBAL_SLOT_COUNT = 76 for SM45,
    //   so it is better to use a bindings, add where a native functions and wrap it in class into the JavaScript
    //   see `fs.js` for sample.
    function defineClass(AForClass: TClass; AProto: TSMCustomProtoObjectClass; aParent: PJSRootedObject = nil): TSMCustomProtoObject;

Board footer

Powered by FluxBB