{"id":17979314,"url":"https://github.com/pauldotknopf/vroomjs-core","last_synced_at":"2025-03-25T17:32:30.285Z","repository":{"id":62355353,"uuid":"52231989","full_name":"pauldotknopf/vroomjs-core","owner":"pauldotknopf","description":"Cross-platform VroomJs with the .NET Core runtime.","archived":false,"fork":false,"pushed_at":"2018-07-10T15:48:27.000Z","size":3020,"stargazers_count":54,"open_issues_count":9,"forks_count":6,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-10-02T14:47:41.925Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pauldotknopf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-21T22:40:33.000Z","updated_at":"2024-09-22T16:46:03.000Z","dependencies_parsed_at":"2022-10-31T10:51:12.891Z","dependency_job_id":null,"html_url":"https://github.com/pauldotknopf/vroomjs-core","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pauldotknopf%2Fvroomjs-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pauldotknopf%2Fvroomjs-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pauldotknopf%2Fvroomjs-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pauldotknopf%2Fvroomjs-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pauldotknopf","download_url":"https://codeload.github.com/pauldotknopf/vroomjs-core/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222089729,"owners_count":16929225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-29T17:37:12.385Z","updated_at":"2024-10-29T17:37:12.861Z","avatar_url":"https://github.com/pauldotknopf.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VroomJs [![NuGet](https://img.shields.io/nuget/v/VroomJs.svg?maxAge=2592000)](https://www.nuget.org/packages/VroomJs/)\n\nThis is a version of VroomJs that can on on the new .NET Core runtime. \n\n## Examples\n\nExecute some Javascript:\n\n```c#\nusing (var engine = new JsEngine())\n{\n    using (var context = engine.CreateContext())\n    {\n        var x = (double)context.Execute(\"3.14159+2.71828\");\n        Console.WriteLine(x);  // prints 5.85987\n    }\n}\n```\n\nCreate and return a Javascript object, then call a method on it:\n\n```c#\nusing (JsEngine js = new JsEngine(4, 32))\n{\n    using (JsContext context = js.CreateContext())\n    {\n        // Create a global variable on the JS side.\n        context.Execute(\"var x = {'answer':42, 'tellme':function (x) { return x+' '+this.answer; }}\");\n        // Get it and use \"dynamic\" to tell the compiler to use runtime binding.\n        dynamic x = context.GetVariable(\"x\");\n        // Call the method and print the result. This will print:\n        // \"What is the answer to ...? 42\"\n        Console.WriteLine(x.tellme(\"What is the answer to ...?\"));\n    }\n}\n```\n\nAccess properties and call methods on CLR objects from Javascript:\n\n```c#\nclass Test\n{\n    public int Value { get; set; }\n    public void PrintValue(string msg)\n    {\n        Console.WriteLine(msg+\" \"+Value);\n    }\n}\n\nusing (JsEngine js = new JsEngine(4, 32))\n{\n    using (JsContext context = js.CreateContext())\n    {\n        context.SetVariable(\"m\", new Test());\n        // Sets the property from Javascript.\n        context.Execute(\"m.Value = 42\");\n        // Call a method on the CLR object from Javascript. This prints:\n        // \"And the answer is (again!): 42\"\n        context.Execute(\"m.PrintValue('And the answer is (again!):')\");\n    }\n}\n```\n## Platforms\n\n### Windows\n\nThere are embedded .dlls (x64/x86) in the project that can be loaded dynamically.\n\n```c#\nVroomJs.AssemblyLoader.EnsureLoaded(); // windows only\n```\n\nCall this method on start of your application.\n\n### Mac/Linux\n\nThe native libraries used in this project must be manually built for Mac/Linux. We are using a forked version of VroomJs used by [ReactJS.NET](http://reactjs.net/). The instructions to generate a native assembly are the same (found [here](http://reactjs.net/guides/mono.html)).\n\n```bash\n# Get a supported version of V8\ncd /usr/local/src/\ngit clone https://github.com/v8/v8.git v8-3.17\ncd v8-3.17\ngit checkout tags/3.17.16.2\n\n# Build V8\nmake dependencies\nmake native werror=no library=shared soname_version=3.17.16.2 -j4\ncp out/native/lib.target/libv8.so.3.17.16.2 /usr/local/lib/\n\n# Get VroomJs's version of libvroomjs\ncd /usr/local/src/\ngit clone https://github.com/pauldotknopf/vroomjs-core.git\ncd vroomjs-core\ncd native/libVroomJs/\n\n# Build libvroomjs\ng++ jscontext.cpp jsengine.cpp managedref.cpp bridge.cpp jsscript.cpp -o libVroomJsNative.so -shared -L /usr/local/src/v8-3.17/out/native/lib.target/ -I /usr/local/src/v8-3.17/include/ -fPIC -Wl,--no-as-needed -l:/usr/local/lib/libv8.so.3.17.16.2\ncp libVroomJsNative.so /usr/local/lib/\nldconfig\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpauldotknopf%2Fvroomjs-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpauldotknopf%2Fvroomjs-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpauldotknopf%2Fvroomjs-core/lists"}