-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
71 extend event #75
71 extend event #75
Conversation
@@ -414,7 +414,7 @@ <h4>Simple Forms</h4> | |||
</footer> | |||
|
|||
|
|||
<script src="./releases/alpha-.10/deer.js" type="module"></script> | |||
<script src="./js/deer.js" type="module"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll put this back before merging. This should be our most recent release and the text version needs to change too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we did a fresh release and i was wondering if you wanted to up the version. We should do that today.
@@ -55,6 +55,9 @@ async function renderChange(mutationsList) { | |||
|
|||
export default class DeerReport { | |||
constructor(elem, deer = {}) { | |||
|
|||
return false | |||
|
|||
for (let key in DEER) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
obviously some trimming here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oo this is scary.
RENDER.detectInsertions = elem => { | ||
let newViews = (elem.querySelectorAll(config.VIEW).length) ? elem.querySelectorAll(config.VIEW) : [] | ||
let newForms = (elem.querySelectorAll(config.FORM).length) ? elem.querySelectorAll(config.VIEW) : [] | ||
if (newForms.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
length might be more than is needed here, I forget why it was done.
UTILS.worker.addEventListener("message", event => { | ||
let templ = DEER.TEMPLATES[elem.getAttribute(DEER.TEMPLATE) || (elem.getAttribute(DEER.COLLECTION) ? "list" : "json")] | ||
if (event.data.action === "expanded") { | ||
RENDER.applyTemplate(elem, event.data.item, templ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe pass options
in here so we aren't checking twice
js/deer-utils.js
Outdated
@@ -105,6 +115,23 @@ export default { | |||
return label || noLabel | |||
} | |||
}, | |||
postView(entity, matchOn = ["__rerum.generatedBy", "creator"]){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the model for form handling and other messages sent into the worker as well.
@@ -105,6 +115,23 @@ export default { | |||
return label || noLabel | |||
} | |||
}, | |||
postView(entity, matchOn = ["__rerum.generatedBy", "creator"]){ | |||
let UTILS = this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point I was having trouble with the scope of this
. Setting it at the top of the function strong-arms the scope to UTILS
so that the key word this
isn't conflated in loops and what not. It may not be necessary any more, but if you plan to undo it for this
make sure to test it and put breakpoints around the uses of this
so you can be sure it is what you expect.
if (typeof findId !== "string") { | ||
return Promise.resolve(entity) | ||
} | ||
return fetch(findId).then(response => response.json()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unchanged, just lifted from expand()
* @param {String} id URI for the targeted entity | ||
* @param [String] targetStyle other formats of resource targeting. May be null | ||
*/ | ||
async function findByTargetId(id, targetStyle = [],queryUrl="http://tinydev.rerum.io/app/query") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
straight copy
* @param Object fromAnno parent annotation of the asserted value, as a handy metadata container. | ||
* @returns Object with `value` and `source` keys. | ||
*/ | ||
function buildValueObject(val, fromAnno) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cp
return valueObject | ||
} | ||
|
||
function getValue(property, alsoPeek = [], asType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cp
@@ -55,6 +55,9 @@ async function renderChange(mutationsList) { | |||
|
|||
export default class DeerReport { | |||
constructor(elem, deer = {}) { | |||
|
|||
return false | |||
|
|||
for (let key in DEER) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oo this is scary.
@@ -105,6 +115,23 @@ export default { | |||
return label || noLabel | |||
} | |||
}, | |||
postView(entity, matchOn = ["__rerum.generatedBy", "creator"]){ | |||
let UTILS = this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point I was having trouble with the scope of this
. Setting it at the top of the function strong-arms the scope to UTILS
so that the key word this
isn't conflated in loops and what not. It may not be necessary any more, but if you plan to undo it for this
make sure to test it and put breakpoints around the uses of this
so you can be sure it is what you expect.
@@ -0,0 +1,162 @@ | |||
const filesToCache = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super fun
next commit moves into correct function
try { | ||
let inputElems = this.inputs | ||
let flatKeys = inputElems.map(input => input.getAttribute(DEER.KEY)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved into utils.js
addresses #74
Still has some unhandled errors when unexpanded renders start, but it does eventually render as expected.
Draft for now, since the edges are still ragged and this will be a big pull, but feel free to comment @thehabes in case this doesn't address your cases.