swiftwasm / swiftwasm/JavaScriptKit

Plugin infrastructure

Open
#66 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Swift
Stars
986
Forks
76
Avg merge
21h 11m
Merged PRs (30d)
4

Description

Currently, JavaScript-based features must be directly implemented in JavaScriptKit to be able to access important features like the heap and the JSValue parsing/serializing routines. This means that less-common things like TypedArray or potential Combine-Promise integration (see #62) would have to increase the bundle size for everyone. One solution to this would be defining some sort of public JS-side API that allows providing custom functions to the WASM runtime. As long as we encourage users of this API to prefix their methods there should be no collision issues.

It would be nice to restructure JavaScriptKit itself to make use of the plugin API too:

  • swjs_core: release
  • swjs_object: get_prop, set_prop, get_subscript, set_subscript, instanceof
  • swjs_string: decode, encode, load
  • swjs_function: call, apply, call_new, create
  • swjs_typedarray: create

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by mapping the existing JavaScript/WASM bridge and the listed entry points: swjs_core, swjs_object, swjs_string, swjs_function, and swjs_typedarray. Determine the public plugin API boundary and how the listed JavaScriptKit features could use it; done means the design is settled and the proposed functions can be migrated without adding unused functionality to every bundle.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, swift, wasm
Domain
api, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.