@remote-ui/core
Advanced tools
Comparing version 0.0.3 to 0.0.5
@@ -6,2 +6,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "RemoteChild", { | ||
enumerable: true, | ||
get: function get() { | ||
return _types.RemoteChild; | ||
} | ||
}); | ||
Object.defineProperty(exports, "createRemoteComponent", { | ||
@@ -16,3 +22,3 @@ enumerable: true, | ||
get: function get() { | ||
return _types.Action; | ||
return _types2.Action; | ||
} | ||
@@ -23,3 +29,3 @@ }); | ||
get: function get() { | ||
return _types.Dispatch; | ||
return _types2.Dispatch; | ||
} | ||
@@ -30,3 +36,3 @@ }); | ||
get: function get() { | ||
return _types.RemoteRoot; | ||
return _types2.RemoteRoot; | ||
} | ||
@@ -37,3 +43,3 @@ }); | ||
get: function get() { | ||
return _types.RemoteComponent; | ||
return _types2.RemoteComponent; | ||
} | ||
@@ -44,3 +50,3 @@ }); | ||
get: function get() { | ||
return _types.RemoteText; | ||
return _types2.RemoteText; | ||
} | ||
@@ -51,3 +57,3 @@ }); | ||
get: function get() { | ||
return _types.Serialized; | ||
return _types2.Serialized; | ||
} | ||
@@ -58,3 +64,3 @@ }); | ||
get: function get() { | ||
return _types.PropsForRemoteComponent; | ||
return _types2.PropsForRemoteComponent; | ||
} | ||
@@ -65,3 +71,3 @@ }); | ||
get: function get() { | ||
return _types.ChildrenForRemoteComponent; | ||
return _types2.ChildrenForRemoteComponent; | ||
} | ||
@@ -82,5 +88,7 @@ }); | ||
var _types = require("@remote-ui/types"); | ||
var _component = require("./component"); | ||
var _types = require("./types"); | ||
var _types2 = require("./types"); | ||
@@ -87,0 +95,0 @@ var _root = require("./root"); |
@@ -230,12 +230,13 @@ "use strict"; | ||
// should only create context once async queue is cleared | ||
var remoteResult = remote(dispatch); | ||
if (remoteResult == null || !('then' in remoteResult)) { | ||
local(); | ||
return; | ||
} else { | ||
return remoteResult.then(function () { | ||
local(); | ||
}); | ||
} | ||
remote(dispatch); // technically, we should be waiting for the remote update to apply, | ||
// then apply it locally. The implementation below is too naive because | ||
// it allows local updates to get out of sync with remote ones. | ||
// if (remoteResult == null || !('then' in remoteResult)) { | ||
// local(); | ||
// return; | ||
// } else { | ||
// return remoteResult.then(() => { | ||
// local(); | ||
// }); | ||
// } | ||
} | ||
@@ -283,4 +284,13 @@ | ||
}); | ||
} | ||
} // there is a problem with this, because when multiple children | ||
// are removed, there is no guarantee the messages will arrive in the | ||
// order we need them to on the host side (it depends how React | ||
// calls our reconciler). If it calls with, for example, the removal of | ||
// the second last item, then the removal of the last item, it will fail | ||
// because the indexes moved around. | ||
// | ||
// Might need to send the removed child ID, or find out if we | ||
// can collect removals into a single update. | ||
function _removeChild(container, child) { | ||
@@ -292,2 +302,4 @@ return perform(container, { | ||
local: function local() { | ||
var _children$get; | ||
parents["delete"](child); | ||
@@ -298,3 +310,3 @@ allDescendants(child, function (descendant) { | ||
var newChildren = _toConsumableArray(children.get(container) || []); | ||
var newChildren = _toConsumableArray((_children$get = children.get(container)) !== null && _children$get !== void 0 ? _children$get : []); | ||
@@ -301,0 +313,0 @@ newChildren.splice(newChildren.indexOf(child), 1); |
@@ -6,2 +6,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "RemoteChild", { | ||
enumerable: true, | ||
get: function () { | ||
return _types.RemoteChild; | ||
} | ||
}); | ||
Object.defineProperty(exports, "createRemoteComponent", { | ||
@@ -16,3 +22,3 @@ enumerable: true, | ||
get: function () { | ||
return _types.Action; | ||
return _types2.Action; | ||
} | ||
@@ -23,3 +29,3 @@ }); | ||
get: function () { | ||
return _types.Dispatch; | ||
return _types2.Dispatch; | ||
} | ||
@@ -30,3 +36,3 @@ }); | ||
get: function () { | ||
return _types.RemoteRoot; | ||
return _types2.RemoteRoot; | ||
} | ||
@@ -37,3 +43,3 @@ }); | ||
get: function () { | ||
return _types.RemoteComponent; | ||
return _types2.RemoteComponent; | ||
} | ||
@@ -44,3 +50,3 @@ }); | ||
get: function () { | ||
return _types.RemoteText; | ||
return _types2.RemoteText; | ||
} | ||
@@ -51,3 +57,3 @@ }); | ||
get: function () { | ||
return _types.Serialized; | ||
return _types2.Serialized; | ||
} | ||
@@ -58,3 +64,3 @@ }); | ||
get: function () { | ||
return _types.PropsForRemoteComponent; | ||
return _types2.PropsForRemoteComponent; | ||
} | ||
@@ -65,3 +71,3 @@ }); | ||
get: function () { | ||
return _types.ChildrenForRemoteComponent; | ||
return _types2.ChildrenForRemoteComponent; | ||
} | ||
@@ -82,5 +88,7 @@ }); | ||
var _types = require("@remote-ui/types"); | ||
var _component = require("./component"); | ||
var _types = require("./types"); | ||
var _types2 = require("./types"); | ||
@@ -87,0 +95,0 @@ var _root = require("./root"); |
@@ -110,12 +110,13 @@ "use strict"; | ||
// should only create context once async queue is cleared | ||
const remoteResult = remote(dispatch); | ||
if (remoteResult == null || !('then' in remoteResult)) { | ||
local(); | ||
return; | ||
} else { | ||
return remoteResult.then(() => { | ||
local(); | ||
}); | ||
} | ||
remote(dispatch); // technically, we should be waiting for the remote update to apply, | ||
// then apply it locally. The implementation below is too naive because | ||
// it allows local updates to get out of sync with remote ones. | ||
// if (remoteResult == null || !('then' in remoteResult)) { | ||
// local(); | ||
// return; | ||
// } else { | ||
// return remoteResult.then(() => { | ||
// local(); | ||
// }); | ||
// } | ||
} | ||
@@ -155,4 +156,13 @@ | ||
}); | ||
} | ||
} // there is a problem with this, because when multiple children | ||
// are removed, there is no guarantee the messages will arrive in the | ||
// order we need them to on the host side (it depends how React | ||
// calls our reconciler). If it calls with, for example, the removal of | ||
// the second last item, then the removal of the last item, it will fail | ||
// because the indexes moved around. | ||
// | ||
// Might need to send the removed child ID, or find out if we | ||
// can collect removals into a single update. | ||
function removeChild(container, child) { | ||
@@ -162,5 +172,7 @@ return perform(container, { | ||
local: () => { | ||
var _children$get; | ||
parents.delete(child); | ||
allDescendants(child, descendant => tops.set(descendant, child)); | ||
const newChildren = [...(children.get(container) || [])]; | ||
const newChildren = [...((_children$get = children.get(container)) !== null && _children$get !== void 0 ? _children$get : [])]; | ||
newChildren.splice(newChildren.indexOf(child), 1); | ||
@@ -167,0 +179,0 @@ children.set(container, Object.freeze(newChildren)); |
@@ -0,1 +1,2 @@ | ||
export { RemoteChild } from '@remote-ui/types'; | ||
export { createRemoteComponent } from './component'; | ||
@@ -2,0 +3,0 @@ export { Action, Dispatch, RemoteRoot, RemoteComponent, RemoteText, Serialized, PropsForRemoteComponent, ChildrenForRemoteComponent, } from './types'; |
@@ -74,12 +74,14 @@ "use strict"; | ||
// should only create context once async queue is cleared | ||
const remoteResult = remote(dispatch); | ||
if (remoteResult == null || !('then' in remoteResult)) { | ||
local(); | ||
return; | ||
} | ||
else { | ||
return remoteResult.then(() => { | ||
local(); | ||
}); | ||
} | ||
remote(dispatch); | ||
// technically, we should be waiting for the remote update to apply, | ||
// then apply it locally. The implementation below is too naive because | ||
// it allows local updates to get out of sync with remote ones. | ||
// if (remoteResult == null || !('then' in remoteResult)) { | ||
// local(); | ||
// return; | ||
// } else { | ||
// return remoteResult.then(() => { | ||
// local(); | ||
// }); | ||
// } | ||
} | ||
@@ -114,2 +116,11 @@ local(); | ||
} | ||
// there is a problem with this, because when multiple children | ||
// are removed, there is no guarantee the messages will arrive in the | ||
// order we need them to on the host side (it depends how React | ||
// calls our reconciler). If it calls with, for example, the removal of | ||
// the second last item, then the removal of the last item, it will fail | ||
// because the indexes moved around. | ||
// | ||
// Might need to send the removed child ID, or find out if we | ||
// can collect removals into a single update. | ||
function removeChild(container, child) { | ||
@@ -119,5 +130,6 @@ return perform(container, { | ||
local: () => { | ||
var _a; | ||
parents.delete(child); | ||
allDescendants(child, (descendant) => tops.set(descendant, child)); | ||
const newChildren = [...(children.get(container) || [])]; | ||
const newChildren = [...(_a = children.get(container), (_a !== null && _a !== void 0 ? _a : []))]; | ||
newChildren.splice(newChildren.indexOf(child), 1); | ||
@@ -124,0 +136,0 @@ children.set(container, Object.freeze(newChildren)); |
{ | ||
"name": "@remote-ui/core", | ||
"version": "0.0.3", | ||
"version": "0.0.5", | ||
"publishConfig": { | ||
@@ -13,3 +13,3 @@ "access": "public", | ||
}, | ||
"gitHead": "9d5212902ec212aa459ca1e4ec451e5b6f31e76c" | ||
"gitHead": "66fed37d8b29212fb575bd8daa419a0366262058" | ||
} |
@@ -0,1 +1,2 @@ | ||
export {RemoteChild} from '@remote-ui/types'; | ||
export {createRemoteComponent} from './component'; | ||
@@ -2,0 +3,0 @@ export { |
@@ -140,12 +140,15 @@ import {RemoteChild} from '@remote-ui/types'; | ||
// should only create context once async queue is cleared | ||
const remoteResult = remote(dispatch); | ||
remote(dispatch); | ||
if (remoteResult == null || !('then' in remoteResult)) { | ||
local(); | ||
return; | ||
} else { | ||
return remoteResult.then(() => { | ||
local(); | ||
}); | ||
} | ||
// technically, we should be waiting for the remote update to apply, | ||
// then apply it locally. The implementation below is too naive because | ||
// it allows local updates to get out of sync with remote ones. | ||
// if (remoteResult == null || !('then' in remoteResult)) { | ||
// local(); | ||
// return; | ||
// } else { | ||
// return remoteResult.then(() => { | ||
// local(); | ||
// }); | ||
// } | ||
} | ||
@@ -201,2 +204,11 @@ | ||
// there is a problem with this, because when multiple children | ||
// are removed, there is no guarantee the messages will arrive in the | ||
// order we need them to on the host side (it depends how React | ||
// calls our reconciler). If it calls with, for example, the removal of | ||
// the second last item, then the removal of the last item, it will fail | ||
// because the indexes moved around. | ||
// | ||
// Might need to send the removed child ID, or find out if we | ||
// can collect removals into a single update. | ||
function removeChild(container: HasChildren, child: CanBeChild) { | ||
@@ -216,3 +228,3 @@ return perform(container, { | ||
const newChildren = [...(children.get(container) || [])]; | ||
const newChildren = [...(children.get(container) ?? [])]; | ||
newChildren.splice(newChildren.indexOf(child as any), 1); | ||
@@ -219,0 +231,0 @@ children.set(container, Object.freeze(newChildren)); |
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
263140
2618