{"id":18365377,"url":"https://github.com/le0pard/elixir_v8","last_synced_at":"2025-04-06T16:31:21.656Z","repository":{"id":18689352,"uuid":"21899033","full_name":"le0pard/elixir_v8","owner":"le0pard","description":"V8 engine for Elixir with pools","archived":false,"fork":false,"pushed_at":"2017-05-31T22:11:45.000Z","size":26,"stargazers_count":68,"open_issues_count":0,"forks_count":9,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-22T03:23:33.853Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://leopard.in.ua/elixir_v8/","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/le0pard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-16T12:02:57.000Z","updated_at":"2024-12-10T09:53:51.000Z","dependencies_parsed_at":"2022-09-26T20:22:01.339Z","dependency_job_id":null,"html_url":"https://github.com/le0pard/elixir_v8","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/le0pard%2Felixir_v8","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/le0pard%2Felixir_v8/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/le0pard%2Felixir_v8/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/le0pard%2Felixir_v8/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/le0pard","download_url":"https://codeload.github.com/le0pard/elixir_v8/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247512603,"owners_count":20950888,"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-11-05T23:13:18.144Z","updated_at":"2025-04-06T16:31:21.412Z","avatar_url":"https://github.com/le0pard.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ElixirV8\n\nV8 engine for [Elixir](http://elixir-lang.org/) with pools.\n\n## Examples\n\nApplication start:\n\n```\nElixirV8.start\n```\nor add it in `application` section in mix:\n\n```\ndef application do\n  [mod: {Example, []},\n   applications: [ :elixir_v8 ] ]\nend\n```\n\n### Create pools\n\n```\nElixirV8.create_pool(:default, 10)\n```\n\nWhere `:default` is name of pool and `10` is size of pool.\n\nAlso you can configure ElixirV8 directly from configuration file to get pools automatically created at application startup. In `config/config.exs`, add :\n\n```\nconfig :elixir_v8, pools: [\n  test_pool:   [{:size, 10}],\n  test_pool_2: [{:size, 20}]\n]\n```\n\n#### Load js libs to v8\n\nYou also can load js libs to each v8 engine in pool:\n\n```\njs_undescore_lib = Mix.Project.app_path \u003c\u003e \"/priv/underscore-min.js\"\n\nElixirV8.create_pool(:main, 10, [{:file, js_undescore_lib}])\n```\n\nUsing config in mix:\n\n```\njs_undescore_lib = Mix.Project.app_path \u003c\u003e \"/priv/underscore-min.js\"\njs_other_lib = Mix.Project.app_path \u003c\u003e \"/priv/some-another-lib.js\"\n\nconfig :elixir_v8,\n  pools: [\n    main: [\n      {:size, 10},\n      {:max_overflow, 10},\n      {:file, js_undescore_lib},\n      {:file, js_other_lib}\n    ]\n  ]\n\n```\n\n### Delete pools\n\n```\nElixirV8.delete_pool(:default)\n\nElixirV8.delete_pool(:test)\n```\n\n### Usage\n\nUsage of pools (`eval` js code):\n\n```\niex(2)\u003e ElixirV8.eval({:global, :main}, \"1+2\")\n{:ok, 3}\niex(3)\u003e ElixirV8.eval({:global, :main}, \"1+2+3\")\n{:ok, 6}\n```\n\nMethod `eval_function` is execute function body with some arguments:\n\n```\niex(4)\u003e ElixirV8.eval_function({:global, :main}, \"return data + 13\", [13])\n{:ok, 26}\niex(6)\u003e ElixirV8.eval_function({:global, :main}, \"return data * 13\", [20])\n{:ok, 260}\niex(8)\u003e ElixirV8.eval_function({:global, :main}, \"return arguments[0] * arguments[1]\", [20, 5])\n{:ok, 100}\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## Publishing to hex\n\n```\nMIX_ENV=\"publish\" mix hex.publish package\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fle0pard%2Felixir_v8","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fle0pard%2Felixir_v8","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fle0pard%2Felixir_v8/lists"}