An approach to build CS apps using composable abstractions and reactive declarative bindings.
eugenen / dna.js Goto Github PK
View Code? Open in Web Editor NEWThe magic to spark life into CS apps
The magic to spark life into CS apps
I have next DNA code:
on-toggle : serialize
Where serialize
is:
serialize: (data, opts) ->
keys = (k for k, _ of data).sort()
([k, merge data[k], opts] for k in keys)
...and on-toggle
fire next data:
HUB['on-toggle']? data, {label: trend}
I've got a problem ...serialize
takes only first argument, data
. opts
argument is an undefined
.
This is my bug or DNA?
I need DNA in the iframe and I should check if the DNA on the page to avoid conflicts.
I think it would be good to add the following features:
embedded node inherits parent nodes protocol;
<div data-extend="MyProtocol">
<span data-subscribe="click : MyProtocol/hide">Content</span>
</div>
In this case inherits MyProtocol.
Add the ability to dynamically add protocols.
Cafe success OSD notification appears, then starts to fade, then appears again.
data-subscribe="click : '' | say 'clicked' "
Double quotes " leads to the conflict with the hiccup templates.
Example:
subscribe="click: someMethod@Interface []"
click will not fire because bool([]) - returns false.
This issue will occur if we will try to pass 0, [], or false as argument to some method.
add after-init etc
Problem: when asynchronous request is runned is necessary to prevent re-initialization of the this request.
Example:
click : load | [getValue@field1 [getValue@field2 getValue@field3] | multiplication] | sum
Problem:
Adding snippet code with the DNA on the target site where already started the DNA.
Solution:
If we have several identical protocols on the one page merge them. If there is a merge conflict, throw an error.
For now async receptors receive their arguments as functions that we need to execute to get the real argument values. I think this is not straightforward behavior.
If we have:
click : disable | loading | authorize | redirect | finished | enable | hide@olay
...we could make a macros and then use him like this (pseudocode):
click : ~loader [authorize | redirect] | hide@olay
Where loader:
loader = (body) -> "disable | loading | #{body} | finished | enable"
Remove dependency from the jQuery. Make all dependencies in the one package.
On initialization:
dna.start_synthesis ROOT_NODE, DNA_CONFIG
No any other dependencies like libprotocol or console-logger.
The protocols that are defined in the data-extend
, should replace implementation of the same methods of the protocols that are defined by default.
Example:
default protocol IDom has a method html
, custom protocol Appearance also has a method html
:
data-extend="Appearance"
data-subscribe='click : "some html" | html'
Now it cause an error. I think that we are should use special symbol /
only when conflict of the methods are presented in the defined protocols in the data-extend
.
fails when is trying to require 'mutation-observer'.
Something like "ambiguous method, please specify interface"
Example:
loadSummary = (cont) -> get "/summary", (response) -> cont response
module.exports =
protocols:
definitions:
IUser: [
['*cons*', ['cont'], {async: true, concerns: {before: [loadSummary]}}]
]
implementations:
IUser: (summary) ->
Если у виджета нет функций (реализация не возвращает объект), то повторный вызов экстенда невозможен
protocol = [
['*cons*', [], {concerns: {before: [extract_opts]}}]
]
impl = (node, node_data) ->
jnode = $ node
if node_data.Utm
jnode.mousedown ->
start_sym = if '?' not in jnode.attr('href') then '?' else '&'
utm_href = jnode.attr('href') + start_sym + node_data.Utm
jnode.attr('href', utm_href)
true
{} # решение
[getValue@field1 getValue@field2 [1 2 3 4 5] | multiplication] | sum
or
[getValue@field1 [getValue@field2 getValue@field3] | multiplication] | sum
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.