{"action":"created","issue":{"url":"https://api.github.com/repos/kangax/fabric.js/issues/2965","repository_url":"https://api.github.com/repos/kangax/fabric.js","labels_url":"https://api.github.com/repos/kangax/fabric.js/issues/2965/labels{/name}","comments_url":"https://api.github.com/repos/kangax/fabric.js/issues/2965/comments","events_url":"https://api.github.com/repos/kangax/fabric.js/issues/2965/events","html_url":"https://github.com/kangax/fabric.js/issues/2965","id":154643188,"number":2965,"title":"Unable to add function to custom Fabric object","user":{"login":"quantumjockey","id":2450829,"avatar_url":"https://avatars.githubusercontent.com/u/2450829?v=3","gravatar_id":"","url":"https://api.github.com/users/quantumjockey","html_url":"https://github.com/quantumjockey","followers_url":"https://api.github.com/users/quantumjockey/followers","following_url":"https://api.github.com/users/quantumjockey/following{/other_user}","gists_url":"https://api.github.com/users/quantumjockey/gists{/gist_id}","starred_url":"https://api.github.com/users/quantumjockey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quantumjockey/subscriptions","organizations_url":"https://api.github.com/users/quantumjockey/orgs","repos_url":"https://api.github.com/users/quantumjockey/repos","events_url":"https://api.github.com/users/quantumjockey/events{/privacy}","received_events_url":"https://api.github.com/users/quantumjockey/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-13T06:33:45Z","updated_at":"2016-05-13T08:34:59Z","closed_at":"2016-05-13T08:34:59Z","body":"I'm not sure that this is a bug or if I'm implementing this improperly, but considering that adding functions to a \"superclass\" of another object is doable in many other contexts I'm not sure why I'm getting this error. \r\n\r\nHere's a JSFiddle demonstrating my issue and the error it's generating:\r\nhttps://jsfiddle.net/quantumjockey/r4gagmL9/\r\n\r\nBasically, all I'm trying to do is over-ride the fabric.Image.fromURL() function in the 'Frindle' class, which is a custom object based on fabric.Image. This object has properties in excess of what fabric.Image provides, formalized in this custom object definition for preservation purposes during serialization/deserialization to/from JSON. Since those properties are all that differentiates this object from a normal image, it made sense to me that the fromURL function could be called and content for the base fabric.Image object initialized as expected.\r\n\r\nInstead, the image doesn't display and I'm getting the (console) error:\r\n'VM616:103 - Uncaught TypeError: fabric.Frindle.fromURL is not a function'\r\n\r\nAre custom objects intended only to have custom properties, i.e. are custom functions not configurable within custom objects? If not, is there a possibility that this workflow will exist in future iterations of FabricJS?"},"comment":{"url":"https://api.github.com/repos/kangax/fabric.js/issues/comments/218983552","html_url":"https://github.com/kangax/fabric.js/issues/2965#issuecomment-218983552","issue_url":"https://api.github.com/repos/kangax/fabric.js/issues/2965","id":218983552,"user":{"login":"asturur","id":1194048,"avatar_url":"https://avatars.githubusercontent.com/u/1194048?v=3","gravatar_id":"","url":"https://api.github.com/users/asturur","html_url":"https://github.com/asturur","followers_url":"https://api.github.com/users/asturur/followers","following_url":"https://api.github.com/users/asturur/following{/other_user}","gists_url":"https://api.github.com/users/asturur/gists{/gist_id}","starred_url":"https://api.github.com/users/asturur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asturur/subscriptions","organizations_url":"https://api.github.com/users/asturur/orgs","repos_url":"https://api.github.com/users/asturur/repos","events_url":"https://api.github.com/users/asturur/events{/privacy}","received_events_url":"https://api.github.com/users/asturur/received_events","type":"User","site_admin":false},"created_at":"2016-05-13T08:34:59Z","updated_at":"2016-05-13T08:34:59Z","body":"I do not have so good undersdaing in how we do inheritance.\r\nBut image fromURL is not in the class if you go to see how it is defined in the source code.\r\n\r\nCheck how i modified the fidde:\r\nhttps://jsfiddle.net/r4gagmL9/2/\r\n\r\nPlease be aware that type of Frindle has to be 'frindle'"}}