GithubHelp home page GithubHelp logo

frozenice / jurassictools Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 1.0 288 KB

some awesome additions to the Jurassic JS engine

Home Page: http://frozenice.de/blog/jurassic-tools/

License: Other

C# 99.94% JavaScript 0.06%

jurassictools's People

Contributors

frozenice avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ti24horas

jurassictools's Issues

O.Prop1.Prop2 fails

when O is exposed, Prop1 of type T2 is exposed and T2.Prop2 is exposed including types,

still O.Prop1.Prop2 fails with undefined error...

Support overloaded methods

The exposer needs a way to group overloaded methods into a single method in the generated proxy class and then conditionally call the correct real method, based on the passed arguments.

Currently there is a quick fix that disables duplicate method names form getting created on the proxy object (see issue #2).

Asserting string_value == null in optional function parameter returns false

Hi,

After rewriting my project to use JurassicTools I found a problem:

[JSFunction(Name = "param")]
public string Parameter(string parameterName, string parameterValue = null, bool global = false){
    if(parameterValue == null){
        // parameterValue is never null
        return ""; // my call in js file is this.param('test');
    }
}

The comparison with null is never true because I think string parameter is backed up by a Jurassic string proxy object.

First test with current Jurassic assembly

Hi!

First of all, great project - thank you for the Expose-Functions :-)

I downloaded the first version of your JurassicTools assembly and added it to my project. Before that, I installed Jurassic via nuget (Jurassic version 2.1.1).

When I try to use Jurassic by itself, everything works fine. But if I try to use your JurassicTools, I get an exception:

image

(German version of the exception, in english its http://unlocalize.com/de/2525_Cannot-load-assembly-x0.html)

Is JurassicTools linked to a specific Jurassic version?

Update: I get the same error If I use Jurassic 2.1.0.0 in my project.

Thank you.

JSPropertyAttribute not exposing properties on ExposeInstance

I can't seam to get properties to expose on instance objects. I have tried creating a class, decorating the property with the JSProperty attribute, and all I get is undefined. The JSFunction attribute works fine.

Ultimately what I'm trying to do is expose properties on controls via RegisterInfos. But, when that didn't work I tried it on my own class to no avail.

' Trying to expose the property here on the third party class
JurassicExposer.RegisterInfos(GetType(Panel), New JurassicInfo("ID", New JSPropertyAttribute()))
JurassicExposer.ExposeClass(Of Panel)(engine)
JurassicExposer.ExposeInstance(engine, ctl, ctl.ID)

' Experimenting with a wrapper here, which works if I create methods, but not properties.
JurassicExposer.ExposeClass(Of ControlWrapper)(engine)
JurassicExposer.ExposeInstance(engine, new ControlWrapper(ctl), ctl.ID)

Public Class ControlWrapper
Private ctl As Control
Public Sub New(ByVal control As Control)
ctl = control
End Sub

<JSProperty>
Public Property ID As String
    Get
        Return ctl.ID
    End Get
    Set(value As String)
        ctl.ID = value
    End Set
End Property

End Class

Exposing methods of an object leads to exception

Hi, me again.

I tried to register a class with your JurassicExposer.

ScriptEngine engine = new ScriptEngine();            
engine.EnableExposedClrTypes = true;
JurassicExposer.ExposeClass<Form>(engine);

I can instantiate a form via Javascript, but the JurassicExposer by itself does not expose methods as functions to call in JS. So I can't just call form.Show via JS.

I looked at your website and tried to imitate the functionality by creating JurassicInfos for each property.

List<JurassicInfo> infos = new List<JurassicInfo>();

foreach (MethodInfo method in typeof(Form).GetMethods(BindingFlags.Instance | BindingFlags.Public))
{
    infos.Add(new JurassicInfo(method.Name, new JSFunctionAttribute()));
}

JurassicExposer.RegisterInfos<Form>(infos.ToArray());

If I try to run that code, an exception occurs:

image
(Parameter count does not match passed in argument value count.)

Am I doing something wrong here?

Thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.