Skip to content

Instantly share code, notes, and snippets.

View yoshuawuyts's full-sized avatar

Yosh yoshuawuyts

View GitHub Profile
// This version gives a "cannot move out of borrowed content error"
let ref fd = &self.fd.unwrap();
// But I guess that's fair game. Docs say it "moves" content, which
// is not what we want. How about expect?
let ref fd = &self.fd.expect("Invalid state: no fd found in Sync::Write");
// Nope, also doesn't work. This is the only version that works fine.
let fd = match &self.fd {
&Some(ref fd) => fd,
module.exports = class Emitter {
constructor () {
this.listeners = {}
}
on (event, listener) {
if (!this.listeners[event]) this.listeners[event] = []
this.listeners[event].push(listener)
}
  • components + component cache (should land in v6)
  • async .toString()
  • all templates return a Promise
  • single export of { App, Store, Component, html, raw }
  • update history events, and move them into the history: namespace
var { App } = require('choo')
var app = new App()
app.store(import('./stores/my-store'))
app.render('body')
{
"owner": "choojs"
}

Notes

  • The structopt crate will probably be merged into the clap crate at some point.
  • [email protected] was released today, and folded the structopt-derive crate into its core. I wonder if serde and failure will be able to do the same in the future.
  • configure and structopt seem a bit at odds with each other. configure works through env vars, while structopt works through flags. The main use case I'm seeing for configure right now is to toggle debug logging. Perhaps this is because I'm not writing network services for production use, yet.

bankai roadmap

source maps

  • source maps brfs
  • source maps css-extract
  • bankai:// protocol for source map serving

assetify

  • optimize assets
  • link to a local file in source files
  • pass in LRU compatible thing into choo constructor
  • pass in LRU compatible thing into separate, nested cache constructors
  • add the .get() method to the cache
  • rename identity to .id
this.local.todos.map(todo => this.cache.get(Todo, Todo.id(todo)).render(todo))

Nanocomponent Constraints

  • self-managing identity, because we can't embed inside diffing algo
  • identity check needs to be static, creating a new instance can't be the solution
  • LRU cache GC
  • one liner for creation + use
  • no imports for management
  • no singletons
  • no extensions of state if possible