diff --git a/lib/core/core.ex b/lib/core/core.ex index b16a0b2..1f1ad68 100644 --- a/lib/core/core.ex +++ b/lib/core/core.ex @@ -63,7 +63,7 @@ defmodule Scopes.Core do end end - def data_only(), do: filter_head([:csys, :data]) + def data_only(dom \\ :csys), do: filter_head([dom, :data]) # send shortcuts @@ -72,14 +72,15 @@ defmodule Scopes.Core do Actor.send(rcvr, Shape.create(head, data: data)) end - def send_value(rcvr, val) do - send_message(rcvr, [:csys, :data], %{value: val}) + def send_value(rcvr, val, dom \\ :csys) do + send_message(rcvr, [dom, :data], %{value: val}) end # notifications def notify_created(msg, new, scope) do - msg1 = Shape.create(~w(csys created)a, + [dom | _rest] = Shape.head(msg) + msg1 = Shape.create([dom, :created], data: Map.merge(Shape.data(msg), %{old: self(), new: new})) notify(msg1, scope) end