/pentode

A conceptual cross platform app framework

Primary LanguageTypeScript

pentode

pentode logo

At this point pentode is conceptual, and may never see a production release. If you're looking for a hybrid framework, we suggest Capacitor, a fantastic framework for generating cross-device hybrid apps quickly and easily. It is a great step in the right direction from Cordova/PhoneGap, which feels dated.

So why, then, another library?

What does pentode do differently?

We're not really an App, we're a...

Most other hybrid frameworks assume you're building a complete app using their toolkit. A WebView, however, is just a component that can interact with other components of the app to exchange data and state. We want to make it possible to build a webview however you want into an otherwise native app. You want to build an app that is 100% WebView? Cool! We'll show you how. But otherwise, why force the issue? Put us where you want.

Our Javascript parts are Written in Typescript, transpiled to everything else.

Typescript makes the codebase cleaner, easier to enforce good practices, easier to... well, you get the point.

Few plugins active by default

All plugins should be explicitely loaded, maybe with the exception of Console.

No native support for other platform plugins

However we may build CordovaWrapper and CapacitorWrapper plugins to allow their plugins to work within our framework. This is not really a priority.

Always return an Observable.

Rather than deal with supporting synchronous and multiple responses with a callback, and one-and-done asynchronous with Promises, we use RxJS Observables, which support the best of both worlds, with the added benefit of being lazy. We'll show you how best to handle these.

// often you'll want to wait on something async.
const asPromised = await MyPlugin.doSomethingPromising().toPromise();

// sometimes you'll do something repeatedly
MyPlugin.doSomethingOverAndOver().forEach(console.log).then(() => console.log('done'));

// or you can make a lazy call
const lazyCall = MyPlugin.doSomethingLater();
setTimeout(() => {
  lazyCall.subscribe(console.log);
}, 1000);

Did someone say Observables?

We're looking into exposing two-way Observable patterns across the bridge. What are the performance implications? What are the use cases? Is it even worth considering? We think so!

Each platform project should be its own thing.

Each platform should have its own build logic, importing common libraries where needed, rather than a centralized place where platforms are added. If you like the centralized aspect then arrange in a monorepo and use tools specialized for that behavior, like lerna. We'll show you how.

Tools and education, no hammer.

Although we may supply some templates and drop-ins, our plan is to give you the tools to do it yourself. Our templates will use those same tools. We'll also give you as much documentation as we can to help you get to where, how and why we do things the way we do. It's easier (and better) to tell you how and why than to force you to do it our way. We're all programmers in the long run.

Earlier registration of Plugins

Capacitor registers the plugins after the WebView is esablished. This doesn't allow Plugins to do things like register with the WebView configuration, and may even result in slower startup time. Instead, Plugins will be instantiated, and then be asked to register with the webview once it is up and ready. How this is done is TBD.

Platform support

As you can see we're pretty ambitious about being truly cross-platform. (Although priority sits with web/ios/android.)

web/pwa

Ideally we will move as much as possible to webworkers when possible. Or at least give the developer that possibility. Get native-like code into a seperate thread.

android

Use JetPack guidance whenever possible.

Some thoughts

  • Use quicktype to generate plugin models for consistncy across all platforms.
  • Use lerna or an equivalent to assist with multiple platform support.

What's in a name?

Since this is inspired by Capacitor, I thought it would be good to find something similar. The Namelix tool gave some great suggestions, and pentode caught my eye. Here's a good distraction for you.