{"id":1200,"date":"2022-08-30T15:14:03","date_gmt":"2022-08-30T15:14:03","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/10\/extend-kinetc-shape-and-all-derived-shapes-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:14:03","modified_gmt":"2022-08-30T15:14:03","slug":"extend-kinetc-shape-and-all-derived-shapes-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/extend-kinetc-shape-and-all-derived-shapes-collection-of-common-programming-errors\/","title":{"rendered":"Extend Kinetc.Shape and all derived shapes-Collection of common programming errors"},"content":{"rendered":"<p>I want to extend the object <code>Kinetic.Shape<\/code> (from which every other shape extends) with some more properties and methods.<\/p>\n<p>What I tried was<\/p>\n<pre><code>Kinetic.Util.addMethods(Kinetic.Shape, {\n  foo: 'bar'\n});\n<\/code><\/pre>\n<p>So say if I created a new <code>Kinetic.Circle<\/code> instance, it should contain this defined property ( and every other shape should do so to).<\/p>\n<pre><code>new Kinetic.Circle(options).foo; \/\/ returns undefined\n\/\/ should return 'bar'\n<\/code><\/pre>\n<p>How can I achieve this behaviour?<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-10 00:09:04. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I want to extend the object Kinetic.Shape (from which every other shape extends) with some more properties and methods. What I tried was Kinetic.Util.addMethods(Kinetic.Shape, { foo: &#8216;bar&#8217; }); So say if I created a new Kinetic.Circle instance, it should contain this defined property ( and every other shape should do so to). new Kinetic.Circle(options).foo; \/\/ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1200","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1200"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1200\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}