@remote-ui/core
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -30,2 +30,14 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "retain", { | ||
enumerable: true, | ||
get: function get() { | ||
return _rpc.retain; | ||
} | ||
}); | ||
Object.defineProperty(exports, "release", { | ||
enumerable: true, | ||
get: function get() { | ||
return _rpc.release; | ||
} | ||
}); | ||
Object.defineProperty(exports, "createRemoteComponent", { | ||
@@ -43,12 +55,12 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "Dispatch", { | ||
Object.defineProperty(exports, "RemoteRoot", { | ||
enumerable: true, | ||
get: function get() { | ||
return _types2.Dispatch; | ||
return _types2.RemoteRoot; | ||
} | ||
}); | ||
Object.defineProperty(exports, "RemoteRoot", { | ||
Object.defineProperty(exports, "RemoteChannel", { | ||
enumerable: true, | ||
get: function get() { | ||
return _types2.RemoteRoot; | ||
return _types2.RemoteChannel; | ||
} | ||
@@ -80,6 +92,6 @@ }); | ||
}); | ||
Object.defineProperty(exports, "Receiver", { | ||
Object.defineProperty(exports, "RemoteReceiver", { | ||
enumerable: true, | ||
get: function get() { | ||
return _receiver.Receiver; | ||
return _receiver.RemoteReceiver; | ||
} | ||
@@ -90,2 +102,4 @@ }); | ||
var _rpc = require("@remote-ui/rpc"); | ||
var _component = require("./component"); | ||
@@ -92,0 +106,0 @@ |
@@ -52,5 +52,5 @@ "use strict"; | ||
}); | ||
exports.Receiver = void 0; | ||
exports.RemoteReceiver = void 0; | ||
var _remoteCall = require("remote-call"); | ||
var _rpc = require("@remote-ui/rpc"); | ||
@@ -89,9 +89,9 @@ var _types = require("./types"); | ||
var Receiver = | ||
var RemoteReceiver = | ||
/*#__PURE__*/ | ||
function () { | ||
function Receiver() { | ||
function RemoteReceiver() { | ||
var _this = this; | ||
_classCallCheck(this, Receiver); | ||
_classCallCheck(this, RemoteReceiver); | ||
@@ -106,3 +106,3 @@ this.root = { | ||
this.dispatch = function (type) { | ||
this.receive = function (type) { | ||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
@@ -124,3 +124,3 @@ args[_key - 1] = arguments[_key]; | ||
var child = _step.value; | ||
(0, _remoteCall.retain)(child); | ||
(0, _rpc.retain)(child); | ||
@@ -165,3 +165,3 @@ _this.attach(child); | ||
(0, _remoteCall.release)(removed); | ||
(0, _rpc.release)(removed); | ||
@@ -186,3 +186,3 @@ _this.detach(removed); | ||
(0, _remoteCall.retain)(_child); | ||
(0, _rpc.retain)(_child); | ||
@@ -218,7 +218,7 @@ _this.attach(_child); | ||
var oldProps = component.props; | ||
(0, _remoteCall.retain)(newProps); | ||
(0, _rpc.retain)(newProps); | ||
for (var _i2 = 0, _Object$keys = Object.keys(newProps); _i2 < _Object$keys.length; _i2++) { | ||
var key = _Object$keys[_i2]; | ||
(0, _remoteCall.release)(oldProps[key]); | ||
(0, _rpc.release)(oldProps[key]); | ||
} | ||
@@ -258,5 +258,5 @@ | ||
_createClass(Receiver, [{ | ||
key: "on", | ||
value: function on(_ref9, listener) { | ||
_createClass(RemoteReceiver, [{ | ||
key: "listen", | ||
value: function listen(_ref9, listener) { | ||
var _this2 = this; | ||
@@ -380,5 +380,5 @@ | ||
return Receiver; | ||
return RemoteReceiver; | ||
}(); | ||
exports.Receiver = Receiver; | ||
exports.RemoteReceiver = RemoteReceiver; |
@@ -80,3 +80,3 @@ "use strict"; | ||
function createRemoteRoot(dispatch, _options) { | ||
function createRemoteRoot(channel, _options) { | ||
var parents = new WeakMap(); | ||
@@ -172,3 +172,3 @@ var children = new WeakMap(); | ||
_context.next = 2; | ||
return regeneratorRuntime.awrap(dispatch(_types.Action.Mount, children.get(remoteRoot).map(serialize))); | ||
return regeneratorRuntime.awrap(channel(_types.Action.Mount, children.get(remoteRoot).map(serialize))); | ||
@@ -232,3 +232,3 @@ case 2: | ||
// should only create context once async queue is cleared | ||
remote(dispatch); // technically, we should be waiting for the remote update to apply, | ||
remote(channel); // technically, we should be waiting for the remote update to apply, | ||
// then apply it locally. The implementation below is too naive because | ||
@@ -251,4 +251,4 @@ // it allows local updates to get out of sync with remote ones. | ||
return perform(text, { | ||
remote: function remote(dispatch) { | ||
return dispatch(_types.Action.UpdateText, text.id, newText); | ||
remote: function remote(channel) { | ||
return channel(_types.Action.UpdateText, text.id, newText); | ||
}, | ||
@@ -263,4 +263,4 @@ local: function local() { | ||
return perform(component, { | ||
remote: function remote(dispatch) { | ||
return dispatch(_types.Action.UpdateProps, component.id, newProps); | ||
remote: function remote(channel) { | ||
return channel(_types.Action.UpdateProps, component.id, newProps); | ||
}, | ||
@@ -275,4 +275,4 @@ local: function local() { | ||
return perform(container, { | ||
remote: function remote(dispatch) { | ||
return dispatch(_types.Action.InsertChild, container.id, container.children.length, serialize(child)); | ||
remote: function remote(channel) { | ||
return channel(_types.Action.InsertChild, container.id, container.children.length, serialize(child)); | ||
}, | ||
@@ -302,4 +302,4 @@ local: function local() { | ||
return perform(container, { | ||
remote: function remote(dispatch) { | ||
return dispatch(_types.Action.RemoveChild, container.id, container.children.indexOf(child)); | ||
remote: function remote(channel) { | ||
return channel(_types.Action.RemoveChild, container.id, container.children.indexOf(child)); | ||
}, | ||
@@ -324,4 +324,4 @@ local: function local() { | ||
return perform(container, { | ||
remote: function remote(dispatch) { | ||
return dispatch(_types.Action.InsertChild, container.id, container.children.indexOf(before), serialize(child)); | ||
remote: function remote(channel) { | ||
return channel(_types.Action.InsertChild, container.id, container.children.indexOf(before), serialize(child)); | ||
}, | ||
@@ -328,0 +328,0 @@ local: function local() { |
@@ -30,2 +30,14 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "retain", { | ||
enumerable: true, | ||
get: function () { | ||
return _rpc.retain; | ||
} | ||
}); | ||
Object.defineProperty(exports, "release", { | ||
enumerable: true, | ||
get: function () { | ||
return _rpc.release; | ||
} | ||
}); | ||
Object.defineProperty(exports, "createRemoteComponent", { | ||
@@ -43,12 +55,12 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "Dispatch", { | ||
Object.defineProperty(exports, "RemoteRoot", { | ||
enumerable: true, | ||
get: function () { | ||
return _types2.Dispatch; | ||
return _types2.RemoteRoot; | ||
} | ||
}); | ||
Object.defineProperty(exports, "RemoteRoot", { | ||
Object.defineProperty(exports, "RemoteChannel", { | ||
enumerable: true, | ||
get: function () { | ||
return _types2.RemoteRoot; | ||
return _types2.RemoteChannel; | ||
} | ||
@@ -80,6 +92,6 @@ }); | ||
}); | ||
Object.defineProperty(exports, "Receiver", { | ||
Object.defineProperty(exports, "RemoteReceiver", { | ||
enumerable: true, | ||
get: function () { | ||
return _receiver.Receiver; | ||
return _receiver.RemoteReceiver; | ||
} | ||
@@ -90,2 +102,4 @@ }); | ||
var _rpc = require("@remote-ui/rpc"); | ||
var _component = require("./component"); | ||
@@ -92,0 +106,0 @@ |
@@ -6,5 +6,5 @@ "use strict"; | ||
}); | ||
exports.Receiver = void 0; | ||
exports.RemoteReceiver = void 0; | ||
var _remoteCall = require("remote-call"); | ||
var _rpc = require("@remote-ui/rpc"); | ||
@@ -15,3 +15,3 @@ var _types = require("./types"); | ||
class Receiver { | ||
class RemoteReceiver { | ||
constructor() { | ||
@@ -26,3 +26,3 @@ this.root = { | ||
this.dispatch = (type, ...args) => { | ||
this.receive = (type, ...args) => { | ||
switch (type) { | ||
@@ -35,3 +35,3 @@ case _types.Action.Mount: | ||
for (const child of children) { | ||
(0, _remoteCall.retain)(child); | ||
(0, _rpc.retain)(child); | ||
this.attach(child); | ||
@@ -50,3 +50,3 @@ } | ||
const [removed] = children.splice(index, 1); | ||
(0, _remoteCall.release)(removed); | ||
(0, _rpc.release)(removed); | ||
this.detach(removed); | ||
@@ -61,3 +61,3 @@ attached.children = children; | ||
const [id = ROOT_ID, index, child] = args; | ||
(0, _remoteCall.retain)(child); | ||
(0, _rpc.retain)(child); | ||
this.attach(child); | ||
@@ -85,6 +85,6 @@ const attached = this.attached.get(id); | ||
} = component; | ||
(0, _remoteCall.retain)(newProps); | ||
(0, _rpc.retain)(newProps); | ||
for (const key of Object.keys(newProps)) { | ||
(0, _remoteCall.release)(oldProps[key]); | ||
(0, _rpc.release)(oldProps[key]); | ||
} | ||
@@ -117,3 +117,3 @@ | ||
on({ | ||
listen({ | ||
id | ||
@@ -168,2 +168,2 @@ }, listener) { | ||
exports.Receiver = Receiver; | ||
exports.RemoteReceiver = RemoteReceiver; |
@@ -10,3 +10,3 @@ "use strict"; | ||
function createRemoteRoot(dispatch, _options) { | ||
function createRemoteRoot(channel, _options) { | ||
const parents = new WeakMap(); | ||
@@ -80,3 +80,3 @@ const children = new WeakMap(); | ||
async mount() { | ||
await dispatch(_types.Action.Mount, children.get(remoteRoot).map(serialize)); | ||
await channel(_types.Action.Mount, children.get(remoteRoot).map(serialize)); | ||
mounted = true; | ||
@@ -112,3 +112,3 @@ } | ||
// should only create context once async queue is cleared | ||
remote(dispatch); // technically, we should be waiting for the remote update to apply, | ||
remote(channel); // technically, we should be waiting for the remote update to apply, | ||
// then apply it locally. The implementation below is too naive because | ||
@@ -131,3 +131,3 @@ // it allows local updates to get out of sync with remote ones. | ||
return perform(text, { | ||
remote: dispatch => dispatch(_types.Action.UpdateText, text.id, newText), | ||
remote: channel => channel(_types.Action.UpdateText, text.id, newText), | ||
local: () => texts.set(text, newText) | ||
@@ -139,3 +139,3 @@ }); | ||
return perform(component, { | ||
remote: dispatch => dispatch(_types.Action.UpdateProps, component.id, newProps), | ||
remote: channel => channel(_types.Action.UpdateProps, component.id, newProps), | ||
local: () => { | ||
@@ -151,3 +151,3 @@ props.set(component, Object.freeze({ ...props.get(component), | ||
return perform(container, { | ||
remote: dispatch => dispatch(_types.Action.InsertChild, container.id, container.children.length, serialize(child)), | ||
remote: channel => channel(_types.Action.InsertChild, container.id, container.children.length, serialize(child)), | ||
local: () => { | ||
@@ -174,3 +174,3 @@ const newTop = container === remoteRoot ? remoteRoot : tops.get(container); | ||
return perform(container, { | ||
remote: dispatch => dispatch(_types.Action.RemoveChild, container.id, container.children.indexOf(child)), | ||
remote: channel => channel(_types.Action.RemoveChild, container.id, container.children.indexOf(child)), | ||
local: () => { | ||
@@ -190,3 +190,3 @@ var _children$get; | ||
return perform(container, { | ||
remote: dispatch => dispatch(_types.Action.InsertChild, container.id, container.children.indexOf(before), serialize(child)), | ||
remote: channel => channel(_types.Action.InsertChild, container.id, container.children.indexOf(before), serialize(child)), | ||
local: () => { | ||
@@ -193,0 +193,0 @@ const newTop = container === remoteRoot ? remoteRoot : tops.get(container); |
export { RemoteChild, RemoteComponentType, PropsForRemoteComponent, AllowedChildrenForRemoteComponent, } from '@remote-ui/types'; | ||
export { retain, release } from '@remote-ui/rpc'; | ||
export { createRemoteComponent } from './component'; | ||
export { Action, Dispatch, RemoteRoot, RemoteComponent, RemoteText, Serialized, } from './types'; | ||
export { Action, RemoteRoot, RemoteChannel, RemoteComponent, RemoteText, Serialized, } from './types'; | ||
export { createRemoteRoot } from './root'; | ||
export { Receiver } from './receiver'; | ||
export { RemoteReceiver } from './receiver'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var rpc_1 = require("@remote-ui/rpc"); | ||
exports.retain = rpc_1.retain; | ||
exports.release = rpc_1.release; | ||
var component_1 = require("./component"); | ||
@@ -10,3 +13,3 @@ exports.createRemoteComponent = component_1.createRemoteComponent; | ||
var receiver_1 = require("./receiver"); | ||
exports.Receiver = receiver_1.Receiver; | ||
exports.RemoteReceiver = receiver_1.RemoteReceiver; | ||
// export * from './validators'; |
@@ -1,2 +0,2 @@ | ||
import { Dispatch, RemoteTextSerialization, RemoteComponentSerialization } from './types'; | ||
import { RemoteChannel, RemoteTextSerialization, RemoteComponentSerialization } from './types'; | ||
declare const ROOT_ID: unique symbol; | ||
@@ -10,3 +10,3 @@ declare type Child = RemoteTextSerialization | RemoteComponentSerialization<any>; | ||
declare type UpdateListener<T extends Attachable> = (updated: T) => void; | ||
export declare class Receiver { | ||
export declare class RemoteReceiver { | ||
readonly root: Root; | ||
@@ -17,4 +17,4 @@ private attached; | ||
private readonly listeners; | ||
readonly dispatch: Dispatch; | ||
on<T extends Attachable>({ id }: T, listener: UpdateListener<T>): () => void; | ||
readonly receive: RemoteChannel; | ||
listen<T extends Attachable>({ id }: T, listener: UpdateListener<T>): () => void; | ||
private enqueueUpdate; | ||
@@ -21,0 +21,0 @@ private attach; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const remote_call_1 = require("remote-call"); | ||
const rpc_1 = require("@remote-ui/rpc"); | ||
const types_1 = require("./types"); | ||
const ROOT_ID = Symbol('RootId'); | ||
class Receiver { | ||
class RemoteReceiver { | ||
constructor() { | ||
@@ -14,3 +14,3 @@ this.root = { id: ROOT_ID, children: [] }; | ||
this.listeners = new Map(); | ||
this.dispatch = (type, ...args) => { | ||
this.receive = (type, ...args) => { | ||
switch (type) { | ||
@@ -21,3 +21,3 @@ case types_1.Action.Mount: { | ||
for (const child of children) { | ||
remote_call_1.retain(child); | ||
rpc_1.retain(child); | ||
this.attach(child); | ||
@@ -33,3 +33,3 @@ } | ||
const [removed] = children.splice(index, 1); | ||
remote_call_1.release(removed); | ||
rpc_1.release(removed); | ||
this.detach(removed); | ||
@@ -42,3 +42,3 @@ attached.children = children; | ||
const [id = ROOT_ID, index, child,] = args; | ||
remote_call_1.retain(child); | ||
rpc_1.retain(child); | ||
this.attach(child); | ||
@@ -61,5 +61,5 @@ const attached = this.attached.get(id); | ||
const { props: oldProps } = component; | ||
remote_call_1.retain(newProps); | ||
rpc_1.retain(newProps); | ||
for (const key of Object.keys(newProps)) { | ||
remote_call_1.release(oldProps[key]); | ||
rpc_1.release(oldProps[key]); | ||
} | ||
@@ -84,3 +84,3 @@ const props = Object.assign(Object.assign({}, component.props), newProps); | ||
} | ||
on({ id }, listener) { | ||
listen({ id }, listener) { | ||
this.listeners.set(id, listener); | ||
@@ -125,2 +125,2 @@ return () => { | ||
} | ||
exports.Receiver = Receiver; | ||
exports.RemoteReceiver = RemoteReceiver; |
import { RemoteChild, RemoteComponentType } from '@remote-ui/types'; | ||
import { Dispatch, RemoteRoot } from './types'; | ||
import { RemoteRoot, RemoteChannel } from './types'; | ||
export interface Options<AllowedComponents extends RemoteComponentType<any, any>> { | ||
readonly components: readonly AllowedComponents[]; | ||
} | ||
export declare function createRemoteRoot<AllowedComponents extends RemoteComponentType<any, any> = RemoteComponentType<any, any>, AllowedChildrenTypes extends AllowedComponents | RemoteChild = RemoteChild>(dispatch: Dispatch, _options: Options<AllowedComponents>): RemoteRoot<AllowedComponents, AllowedChildrenTypes>; | ||
export declare function createRemoteRoot<AllowedComponents extends RemoteComponentType<any, any> = RemoteComponentType<any, any>, AllowedChildrenTypes extends AllowedComponents | RemoteChild = RemoteChild>(channel: RemoteChannel, _options: Options<AllowedComponents>): RemoteRoot<AllowedComponents, AllowedChildrenTypes>; | ||
//# sourceMappingURL=root.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const types_1 = require("./types"); | ||
function createRemoteRoot(dispatch, _options) { | ||
function createRemoteRoot(channel, _options) { | ||
const parents = new WeakMap(); | ||
@@ -51,3 +51,3 @@ const children = new WeakMap(); | ||
async mount() { | ||
await dispatch(types_1.Action.Mount, children.get(remoteRoot).map(serialize)); | ||
await channel(types_1.Action.Mount, children.get(remoteRoot).map(serialize)); | ||
mounted = true; | ||
@@ -75,3 +75,3 @@ }, | ||
// should only create context once async queue is cleared | ||
remote(dispatch); | ||
remote(channel); | ||
// technically, we should be waiting for the remote update to apply, | ||
@@ -93,3 +93,3 @@ // then apply it locally. The implementation below is too naive because | ||
return perform(text, { | ||
remote: (dispatch) => dispatch(types_1.Action.UpdateText, text.id, newText), | ||
remote: (channel) => channel(types_1.Action.UpdateText, text.id, newText), | ||
local: () => texts.set(text, newText), | ||
@@ -100,3 +100,3 @@ }); | ||
return perform(component, { | ||
remote: (dispatch) => dispatch(types_1.Action.UpdateProps, component.id, newProps), | ||
remote: (channel) => channel(types_1.Action.UpdateProps, component.id, newProps), | ||
local: () => { | ||
@@ -109,3 +109,3 @@ props.set(component, Object.freeze(Object.assign(Object.assign({}, props.get(component)), newProps))); | ||
return perform(container, { | ||
remote: (dispatch) => dispatch(types_1.Action.InsertChild, container.id, container.children.length, serialize(child)), | ||
remote: (channel) => channel(types_1.Action.InsertChild, container.id, container.children.length, serialize(child)), | ||
local: () => { | ||
@@ -131,3 +131,3 @@ const newTop = container === remoteRoot ? remoteRoot : tops.get(container); | ||
return perform(container, { | ||
remote: (dispatch) => dispatch(types_1.Action.RemoveChild, container.id, container.children.indexOf(child)), | ||
remote: (channel) => channel(types_1.Action.RemoveChild, container.id, container.children.indexOf(child)), | ||
local: () => { | ||
@@ -145,3 +145,3 @@ var _a; | ||
return perform(container, { | ||
remote: (dispatch) => dispatch(types_1.Action.InsertChild, container.id, container.children.indexOf(before), serialize(child)), | ||
remote: (channel) => channel(types_1.Action.InsertChild, container.id, container.children.indexOf(before), serialize(child)), | ||
local: () => { | ||
@@ -148,0 +148,0 @@ const newTop = container === remoteRoot ? remoteRoot : tops.get(container); |
@@ -27,3 +27,3 @@ import { RemoteComponentType, RemoteChild, PropsForRemoteComponent, AllowedChildrenForRemoteComponent } from '@remote-ui/types'; | ||
} | ||
export interface Dispatch { | ||
export interface RemoteChannel { | ||
<T extends Action>(type: T, ...payload: MessageMap[T]): void | Promise<void>; | ||
@@ -30,0 +30,0 @@ } |
{ | ||
"name": "@remote-ui/core", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"publishConfig": { | ||
@@ -13,3 +13,3 @@ "access": "public", | ||
}, | ||
"gitHead": "4c8a98663c7a2144c22698090fb9ffc50fdafa51" | ||
"gitHead": "c983682d8602256e4f8fef925d098785b300d0c8" | ||
} |
@@ -8,7 +8,9 @@ export { | ||
export {retain, release} from '@remote-ui/rpc'; | ||
export {createRemoteComponent} from './component'; | ||
export { | ||
Action, | ||
Dispatch, | ||
RemoteRoot, | ||
RemoteChannel, | ||
RemoteComponent, | ||
@@ -19,3 +21,3 @@ RemoteText, | ||
export {createRemoteRoot} from './root'; | ||
export {Receiver} from './receiver'; | ||
export {RemoteReceiver} from './receiver'; | ||
// export * from './validators'; |
@@ -1,6 +0,6 @@ | ||
import {retain, release} from 'remote-call'; | ||
import {retain, release} from '@remote-ui/rpc'; | ||
import { | ||
Action, | ||
Dispatch, | ||
MessageMap, | ||
RemoteChannel, | ||
RemoteTextSerialization, | ||
@@ -23,3 +23,3 @@ RemoteComponentSerialization, | ||
export class Receiver { | ||
export class RemoteReceiver { | ||
readonly root: Root = {id: ROOT_ID, children: []}; | ||
@@ -38,3 +38,3 @@ private attached = new Map<string | typeof ROOT_ID, Attachable>([ | ||
readonly dispatch: Dispatch = (type, ...args) => { | ||
readonly receive: RemoteChannel = (type, ...args) => { | ||
switch (type) { | ||
@@ -131,3 +131,3 @@ case Action.Mount: { | ||
on<T extends Attachable>({id}: T, listener: UpdateListener<T>) { | ||
listen<T extends Attachable>({id}: T, listener: UpdateListener<T>) { | ||
this.listeners.set(id, listener); | ||
@@ -134,0 +134,0 @@ |
import {RemoteChild, RemoteComponentType} from '@remote-ui/types'; | ||
import { | ||
Action, | ||
Dispatch, | ||
Serialized, | ||
RemoteRoot, | ||
RemoteText, | ||
RemoteChannel, | ||
RemoteComponent, | ||
@@ -27,3 +27,3 @@ // RemoteComponentInsertChildViolation, | ||
>( | ||
dispatch: Dispatch, | ||
channel: RemoteChannel, | ||
_options: Options<AllowedComponents>, | ||
@@ -109,3 +109,3 @@ ): RemoteRoot<AllowedComponents, AllowedChildrenTypes> { | ||
async mount() { | ||
await dispatch(Action.Mount, children.get(remoteRoot)!.map(serialize)); | ||
await channel(Action.Mount, children.get(remoteRoot)!.map(serialize)); | ||
mounted = true; | ||
@@ -145,3 +145,3 @@ }, | ||
}: { | ||
remote(dispatch: Dispatch): void | Promise<void>; | ||
remote(channel: RemoteChannel): void | Promise<void>; | ||
local(): void; | ||
@@ -152,3 +152,3 @@ }, | ||
// should only create context once async queue is cleared | ||
remote(dispatch); | ||
remote(channel); | ||
@@ -173,3 +173,3 @@ // technically, we should be waiting for the remote update to apply, | ||
return perform(text, { | ||
remote: (dispatch) => dispatch(Action.UpdateText, text.id, newText), | ||
remote: (channel) => channel(Action.UpdateText, text.id, newText), | ||
local: () => texts.set(text, newText), | ||
@@ -181,4 +181,3 @@ }); | ||
return perform(component, { | ||
remote: (dispatch) => | ||
dispatch(Action.UpdateProps, component.id, newProps), | ||
remote: (channel) => channel(Action.UpdateProps, component.id, newProps), | ||
local: () => { | ||
@@ -195,4 +194,4 @@ props.set( | ||
return perform(container, { | ||
remote: (dispatch) => | ||
dispatch( | ||
remote: (channel) => | ||
channel( | ||
Action.InsertChild, | ||
@@ -230,4 +229,4 @@ (container as any).id, | ||
return perform(container, { | ||
remote: (dispatch) => | ||
dispatch( | ||
remote: (channel) => | ||
channel( | ||
Action.RemoveChild, | ||
@@ -256,4 +255,4 @@ (container as any).id, | ||
return perform(container, { | ||
remote: (dispatch) => | ||
dispatch( | ||
remote: (channel) => | ||
channel( | ||
Action.InsertChild, | ||
@@ -260,0 +259,0 @@ (container as any).id, |
@@ -45,3 +45,3 @@ import { | ||
export interface Dispatch { | ||
export interface RemoteChannel { | ||
<T extends Action>(type: T, ...payload: MessageMap[T]): void | Promise<void>; | ||
@@ -48,0 +48,0 @@ } |
@@ -9,3 +9,3 @@ { | ||
"include": ["src/**/*.ts"], | ||
"references": [{"path": "../remote-call"}, {"path": "../types"}] | ||
"references": [{"path": "../rpc"}, {"path": "../types"}] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
280726
51
2720
0
325