Skip to content

Instantly share code, notes, and snippets.

@barneycarroll
Last active October 18, 2017 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barneycarroll/4fb3939380e2ccb235beec8937e62395 to your computer and use it in GitHub Desktop.
Save barneycarroll/4fb3939380e2ccb235beec8937e62395 to your computer and use it in GitHub Desktop.
The ability to define virtual DOM structure in one place and have it render in another
const Portal = {
view : ({attrs, content = []}) =>
attrs.view({
outlet: () =>
content,
inlet: (...input) => {
content.splice(0, Infinity, ...input)
},
})
}
try{ module.exports = Portal } catch(e){}
@barneycarroll
Copy link
Author

Streams are an unnecessary dependency and introduce too much ambiguity. Inlet is just a setter. Outlet is just a getter. Remove the dep and make the code more explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment