DEV Community

loading...

Discussion on: Good Bye Web APIs

Collapse
hakimio profile image
Tomas Rimkus • Edited

This reminds me a bit of Firebase callable functions. In case of Firebase, you can only export functions, but not whole classes.
Basically on the backend side (Firebase function) you export the function:

export const doSomething = functions.https.onCall((data, context) => {
  // do something
  return {baz: data.foo};
});
Enter fullscreen mode Exit fullscreen mode

and then you can call it on the fronted:

const doSomethingFn = firebase.functions().httpsCallable('doSomething');
const result = await doSomehtingFn({foo: bar});

console.log(result.data.baz);
Enter fullscreen mode Exit fullscreen mode

I like your way more because it's OOP instead of functional programming. Also, I really like how you use TypeScript decorators for exposing class properties and methods. I just think it would be better if Component was also a decorator like in Angular (Component) and NestJS (Controller) instead of a class you have to extend. This way it would be a lot more flexible.

Collapse
mvila profile image
Manuel Vila Author

I just think it would be better if Component was also a decorator like in Angular (Component) and NestJS (Controller) instead of a class you have to extend. This way it would be a lot more flexible.

It's feasible and I agree that it would bring more flexibility. I'll put more thought into it. Thanks, @hakimio !

Collapse
hakimio profile image
Tomas Rimkus

Some recommendations for inspiration:

Also, I think it would be nice if the frontend library would be framework agnostic and would work with all major SPA frameworks/libraries: React, Angular and Vue.

Anyway, I really like your project and I think it has a lot of potential. Hope, it will get more recognition from the community and you'll have motivation to continue developing it.

Thread Thread
mvila profile image
Manuel Vila Author

Also, I think it would be nice if the frontend library would be framework agnostic and would work with all major SPA frameworks/libraries: React, Angular and Vue.

Layr is designed to be UI framework agnostic but for now, there is only a React integration.

Thanks for your links and your encouraging words.