GithubHelp home page GithubHelp logo

Comments (3)

rafaelw avatar rafaelw commented on July 18, 2024

Please read the bottom of the README (https://github.com/Polymer/observe-js)
"About delivery of changes".

Short answer: if Object.observe is not present, you need to call
Platform.performMicrotaskCheckpoint() to trigger dirty-checking of
observers and delivery of changes.

On Sun, Dec 8, 2013 at 6:05 AM, Rob Evans [email protected] wrote:

Hey guys,

I've been playing with this lib to see if I can use it as a polyfill. I've
included the observe.js and in the console created a basic object:

var a = { moo: 0 };

Then added a path observer:

new PathObserver(a, 'moo', function() { console.log(arguments); });

Then updated the object:

a.moo = 2;

Nothing gets called. I've also tried multiple different ways of doing this
but no luck. Can someone point me in the right direction here? :) thank you!


Reply to this email directly or view it on GitHubhttps://github.com//issues/36
.

from observe-js.

wereHamster avatar wereHamster commented on July 18, 2024

The readme is wrong. The API has changed. PathObserver constructor now only takes two arguments, and you attach callbacks in a separate call:

var observer = new PathObserver(a, 'moo');
observer.open(function() { console.log(arguments); });

See also how it's used in the tests: https://github.com/Polymer/observe-js/blob/04285a42bd8dfb7998709149e2c20ce204bd8148/tests/test.js

from observe-js.

rafaelw avatar rafaelw commented on July 18, 2024

Apologies for the stale API docs. I've updated the docs. Please open more bugs if you find any other problems.

from observe-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.