Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugin): multiple worklet referencing #6904

Merged
merged 2 commits into from
Feb 7, 2025

Conversation

tjzel
Copy link
Collaborator

@tjzel tjzel commented Jan 15, 2025

Summary

Some time ago I added a feature of worklet referencing to the Plugin, but this was limited to only a single reference:

function foo(){
	// UI stuff
};

runOnUI(foo)(); // ok, `foo` will get workletized

function bar(){
	// UI stuff
};

const foobar = bar;

runOnUI(foobar); // error, foobar didn't get workletized

This PR allows for any amount of references in the reference chain. Simultaneously I discovered that Gesture Handler callbacks didn't benefit from worklet referencing, i.e. the following code would be invalid:

function foo(){
	// do something
}

const pan = Gesture.Pan().onActive(foo) // `foo` wouldn't be workletized

This PR adds this QoL feat for Gesture Handler callbacks.

Test plan

I added new unit tests for these cases.

@tomekzaw tomekzaw self-requested a review January 16, 2025 10:05
@tjzel tjzel marked this pull request as ready for review January 20, 2025 17:16
@tjzel tjzel added this pull request to the merge queue Feb 7, 2025
Merged via the queue into main with commit f5c06cc Feb 7, 2025
9 checks passed
@tjzel tjzel deleted the @tjzel/plugin/multiple-referencing branch February 7, 2025 13:21
tjzel added a commit that referenced this pull request Feb 17, 2025
Some time ago I added a feature of worklet referencing to the Plugin,
but this was limited to only a single reference:

```ts
function foo(){
	// UI stuff
};

runOnUI(foo)(); // ok, `foo` will get workletized

function bar(){
	// UI stuff
};

const foobar = bar;

runOnUI(foobar); // error, foobar didn't get workletized
```

This PR allows for any amount of references in the reference chain.
Simultaneously I discovered that Gesture Handler callbacks didn't
benefit from worklet referencing, i.e. the following code would be
invalid:

```ts
function foo(){
	// do something
}

const pan = Gesture.Pan().onActive(foo) // `foo` wouldn't be workletized
```

This PR adds this QoL feat for Gesture Handler callbacks.

I added new unit tests for these cases.
tjzel added a commit that referenced this pull request Feb 18, 2025
Some time ago I added a feature of worklet referencing to the Plugin,
but this was limited to only a single reference:

```ts
function foo(){
	// UI stuff
};

runOnUI(foo)(); // ok, `foo` will get workletized

function bar(){
	// UI stuff
};

const foobar = bar;

runOnUI(foobar); // error, foobar didn't get workletized
```

This PR allows for any amount of references in the reference chain.
Simultaneously I discovered that Gesture Handler callbacks didn't
benefit from worklet referencing, i.e. the following code would be
invalid:

```ts
function foo(){
	// do something
}

const pan = Gesture.Pan().onActive(foo) // `foo` wouldn't be workletized
```

This PR adds this QoL feat for Gesture Handler callbacks.

I added new unit tests for these cases.
tjzel added a commit that referenced this pull request Feb 18, 2025
Some time ago I added a feature of worklet referencing to the Plugin,
but this was limited to only a single reference:

```ts
function foo(){
	// UI stuff
};

runOnUI(foo)(); // ok, `foo` will get workletized

function bar(){
	// UI stuff
};

const foobar = bar;

runOnUI(foobar); // error, foobar didn't get workletized
```

This PR allows for any amount of references in the reference chain.
Simultaneously I discovered that Gesture Handler callbacks didn't
benefit from worklet referencing, i.e. the following code would be
invalid:

```ts
function foo(){
	// do something
}

const pan = Gesture.Pan().onActive(foo) // `foo` wouldn't be workletized
```

This PR adds this QoL feat for Gesture Handler callbacks.

I added new unit tests for these cases.
patrycjakalinska pushed a commit that referenced this pull request Mar 12, 2025
Some time ago I added a feature of worklet referencing to the Plugin,
but this was limited to only a single reference:

```ts
function foo(){
	// UI stuff
};

runOnUI(foo)(); // ok, `foo` will get workletized

function bar(){
	// UI stuff
};

const foobar = bar;

runOnUI(foobar); // error, foobar didn't get workletized
```

This PR allows for any amount of references in the reference chain.
Simultaneously I discovered that Gesture Handler callbacks didn't
benefit from worklet referencing, i.e. the following code would be
invalid:

```ts
function foo(){
	// do something
}

const pan = Gesture.Pan().onActive(foo) // `foo` wouldn't be workletized
```

This PR adds this QoL feat for Gesture Handler callbacks.

I added new unit tests for these cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants