![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Dyo is a JavaScript library for building user interfaces.
Learn how to use Dyo in your own project.
<script type=module src=dyo.js></script>
.<script src=unpkg.com/dyo></script>
.npm install dyo --save
You can find the Dyo documentation on the website.
Check out the Getting Started page for a quick overview.
The documentation is divided into several sections:
You can improve it by sending pull requests to this repository.
You can find several examples on the website. Here is the first one to get you started:
import {h, render, Component} from 'dyo'
class Hello extends Component {
render(props) {
return h('div', 'Hello ', props.name)
}
}
render(h(Hello, {name: 'World'}), 'main')
This example will render "Hello World" into the specified container on the page.
The following is an overview of the features that Dyo affords.
Dyo is much alike React, so it's only natural that a comparison of the differences is in order; Which if succesfull might manage to highlight why it exists.
Dyo affords authors the ability to create custom renderer, the interface around this is implicit in contrast to React.
The createPortal
interface supports string selectors and accepts props as an additional optional argument. This presents an array of different possibilities around container references and property mutations that you can propagate to portal containers.
In addition to this – support for re-parenting is backed into portals. That is when a portals container is changed, instead of unmounting its contents and re-mounting them to the newly designated container we can instead move its contents without replaying destruction unmount operations that may discard valuable state.
In coordination with custom renderers, portals afford the opportunity to create atomic branch specific custom renderers. Imagine isolated declarative canvas renderers within a tree.
Dyo treats promises(thenables) as first class values. This affords authors the ability to render promises, update state with promises, and delay unmounting with promises.
render(h(Promise.resolve('Hello'), {timeout: 500}, 'Loading...'))
class Hello extends Component {
async handleEvent() {
return {name: 'World'}
}
}
class Hello extends Component {
async componentWillUnmount() {
return this.refs.heading.animate([...], {...}).finished
}
}
In an async world, public interfaces like render
, setState
and forceUpdate
are not guaranteed to run to completion synchronously if a subtree happens to have async dependencies within it. A consequence of this will see more use cases for the optional callback
arguments that these functions normally accept. Adding to this authors are afforded the ability to await on these common routines.
await render(h(Promise.resolve('Hello')))
class extends Component {
async componentDidMount() {
await this.setState({...})
}
}
class extends Component {
async componentDidMount() {
await this.forceUpdate()
}
}
Dyo affords authors the the ability to author events with an array of multiple event handlers and a chance to avoid the sometimes daunting relationship with the "this" keyword.
class Hello extends Component {
handleSubmit(e, props, state, context) {
assert(this instanceof Hello)
}
handleReset(e, props, state, context) {
assert(this instanceof Hello)
}
render(props, state, context) {
return h('form', {onSubmit: [this.handleSubmit, this.handleReset]})
}
}
In contrast to React error boundaries do not implicitly unmount the affected tree or print default error messages when an error is caught.
Error boundaries act much like the try..catch control-flow sementics present in the language, safely giving authors the ability to create richer primitives around the some-what niche control-flow mechanism that a throw..catch routine might afford.
In contrast to React PureComponent
shallow compares context
in addition to props
and state
.
In contrast to React components that extend either Component
or PureComponent
have an implicit render
method that render props.children
. This affords authors a chance to ommit the implemention of the render
method altogether when returning props.children
is the intended sementic.
In addition to the iterator protocol, Dyo also supports the async iterator protocol, where every iteration is a step in the sequence of state transitions updates, modeled to afford authors the primitive to implement psuedo-synchronous designs from otherwise asynchronous application interfaces.
class Generator extends Component {
async *render() {
yield 'Loading...'
const data = await fetch('./')
yield h('pre', JSON.stringify(data))
}
}
Dyo is MIT licensed.
FAQs
Dyo is a JavaScript library for building user interfaces
The npm package dyo receives a total of 28 weekly downloads. As such, dyo popularity was classified as not popular.
We found that dyo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.