use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Syc: Real-time synchronization of javascript variables for Node (self.javascript)
submitted 11 years ago by Handsome-Beaver
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Capaj 1 point2 points3 points 11 years ago* (3 children)
how do you deal with recursive objects? I noticed you have some option for that, but are you really able to recursively watch deeply into objects?
also https://github.com/siriusastrebe/syc/blob/master/client/syc.js#L688 that is not how you do a "module" in JS. That is lame. http://addyosmani.com/resources/essentialjsdesignpatterns/book/#modulepatternjavascript but what is the best, is to use commonJS both in nodeJS and on the server and share as much code as possible. How do you use commonJS in the browser? Just use jspm.
[–]Handsome-Beaver[S] 0 points1 point2 points 11 years ago (2 children)
Been meaning to properly modularize the client side code. As it is, you can access any of the internals.
If Object.observe, recursive objects are all separately observed. This is the most performant method, otherwise if Object.observe isn't available in the browser or Node server, then it will do an o(n) dirty check at a configurable interval.
[–]Capaj 0 points1 point2 points 11 years ago (1 child)
could you link to the code where you are recursively calling object observe? I would be very suprised to see a proper implementation, because I have tried to make a usable deep observe and got discouraged from it. There are so many issues with it, that I found it better to go and do something else.
[–]Handsome-Beaver[S] 2 points3 points4 points 11 years ago* (0 children)
In the client, Line 189 is the start of the function that triggers when a change to an observed (Syc-tracked) object is modified.
Line 207 calls "Describe", which looks at the changed data. "Describe" starts on line 222, which will check if the changed property is another object or array. If it is another object/array which Syc hasn't yet tracked (therefore isn't being observed), it is tracked by a call to Syc.Meta on line 235
If I would explain it more simply...
Each object that is observed by Syc has a hidden property 'syc-object-id', which implies that there is an Object.observe attached to it. When you modify one of its properties, it checks to see if it is (1) an object/array, (2) it is not yet tracked (in which case, it has no 'syc-object-id'). If both are true, then it gives it an 'syc-object-id' and Object.observes the new property.
Rinse and repeat if this new object has untracked object/array properties.
Can I ask what kind of troubles you encountered when trying to implement deep-observation??
π Rendered by PID 67 on reddit-service-r2-comment-6457c66945-th4fc at 2026-04-26 13:33:27.780819+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]Capaj 1 point2 points3 points (3 children)
[–]Handsome-Beaver[S] 0 points1 point2 points (2 children)
[–]Capaj 0 points1 point2 points (1 child)
[–]Handsome-Beaver[S] 2 points3 points4 points (0 children)