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

[Feature Request] 可以支持 solidjs 的的使用吗 #117

Open
Yanren1225 opened this issue Jun 14, 2023 · 9 comments
Open

[Feature Request] 可以支持 solidjs 的的使用吗 #117

Yanren1225 opened this issue Jun 14, 2023 · 9 comments
Labels
feature-request:confirmed New feature that has confirmed good first issue Good for newcomers

Comments

@Yanren1225
Copy link

你在什么情况下,需要这个功能解决什么问题?

可以支持 solidjs 的的使用吗?

你期望的 API 是什么样子的?

solidjs 与 react 有着相似的响应式使用方法,应该可以很方便的支持

@Yanren1225 Yanren1225 changed the title [Feature Request] 请在此填写标题 [Feature Request] 可以支持 solidjs 的的使用吗 Jun 14, 2023
@JOU-amjs
Copy link
Contributor

JOU-amjs commented Jun 14, 2023

solidjs在我们的计划中,但短期内暂时还没计划支持solidjs。
从使用者的角度来说可能写一个statesHook就可以了,但从alova的角度来说,工作量是比较大的,还需要通过单元测试,typescript类型兼容,scene请求策略hooks的兼容和测试。

如果需要,你可以试试自定义statesHook,可以快速满足你的需求。
不着急的话,也可以稍微耐心等待我们提供。

@JOU-amjs JOU-amjs added the help wanted Extra attention is needed label Jun 14, 2023
@tendant
Copy link

tendant commented Jul 12, 2023

请问这个已经实现了吗?

可以提供一个简单的statesHook 吗?这样对于初次接触Alova 的用户会更友好一点。

@JOU-amjs
Copy link
Contributor

@tendant 目前还没有实现solidjs的statesHook,可以期待一下哦

@JOU-amjs JOU-amjs added feature-request:confirmed New feature that has confirmed good first issue Good for newcomers and removed help wanted Extra attention is needed labels Jul 29, 2023
@JOU-amjs JOU-amjs reopened this Jul 29, 2023
@JOU-amjs
Copy link
Contributor

有人愿意贡献你的一份力量吗? 请阅读贡献指南

@wintsa123
Copy link

solid太小众了吧,玩这种新框架的,我不信没能力自己写statesHook

@thinke5
Copy link

thinke5 commented Nov 27, 2023

这有一个简单的实现,没有完整测试,不保证100%可用,也不提供售后

const solidJsHook = {
  create: (data) => createSignal(data),
  export: (states) => states[0],
  dehydrate: (state: any) => state(),
  update: (newVal, states) => {
    Object.keys(newVal).forEach((key) => {
      states[key][1](newVal[key]);
    });
  },
  effectRequest({ handler, removeStates, immediate, watchingStates }) {
    onCleanup(removeStates);

    immediate && handler();

    let timer: any;
    (watchingStates || []).forEach((state, i) => {
      createEffect(() => {
        state();
        timer && clearTimeout(timer);
        timer = setTimeout(() => {
          handler(i);
          clearTimeout(timer);
          timer = undefined;
        }, 8);
      });
    });
  },
};

@JOU-amjs
Copy link
Contributor

JOU-amjs commented Nov 30, 2023

@thinkeW 非常感谢你的贡献啊!🤞
需要使用的朋友可以复制到自己项目里作为自定义statesHook使用。
如果需要作为alova预定义的statesHook并达到可用状态的话,还需要通过单元测试才可以正常投入使用。
如果有兴趣的话,可以在项目目录下新建test/browser/hooks/solid并模仿react的hooks测试用例测试

@1075488066
Copy link

solidjs在我们的计划中,但短期内暂时还没计划支持solidjs。
从使用者的角度来说可能写一个statesHook就可以了,但从alova的角度来说,工作量是比较大的,还需要通过单元测试,typescript类型兼容,scene请求策略hooks的兼容和测试。

如果需要,你可以试试自定义statesHook,可以快速满足你的需求。
不着急的话,也可以稍微耐心等待我们提供。

我觉得原生微信小程序可以支持下,其他web框架类似的功能不怎么缺。

@JOU-amjs
Copy link
Contributor

@1075488066 原生小程序支持计划中,期待一下哦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request:confirmed New feature that has confirmed good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

6 participants