Last active
October 18, 2017 18:01
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Portal = { | |
view : ({attrs, content = []}) => | |
attrs.view({ | |
outlet: () => | |
content, | |
inlet: (...input) => { | |
content.splice(0, Infinity, ...input) | |
}, | |
}) | |
} | |
try{ module.exports = Portal } catch(e){} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.