{"action":"created","issue":{"url":"https://api.github.com/repos/winjs/winjs/issues/904","labels_url":"https://api.github.com/repos/winjs/winjs/issues/904/labels{/name}","comments_url":"https://api.github.com/repos/winjs/winjs/issues/904/comments","events_url":"https://api.github.com/repos/winjs/winjs/issues/904/events","html_url":"https://github.com/winjs/winjs/issues/904","id":55559765,"number":904,"title":"Use JavaScript \"class\" for fragment definition","user":{"login":"gleborgne","id":239691,"avatar_url":"https://avatars.githubusercontent.com/u/239691?v=3","gravatar_id":"","url":"https://api.github.com/users/gleborgne","html_url":"https://github.com/gleborgne","followers_url":"https://api.github.com/users/gleborgne/followers","following_url":"https://api.github.com/users/gleborgne/following{/other_user}","gists_url":"https://api.github.com/users/gleborgne/gists{/gist_id}","starred_url":"https://api.github.com/users/gleborgne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gleborgne/subscriptions","organizations_url":"https://api.github.com/users/gleborgne/orgs","repos_url":"https://api.github.com/users/gleborgne/repos","events_url":"https://api.github.com/users/gleborgne/events{/privacy}","received_events_url":"https://api.github.com/users/gleborgne/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/winjs/winjs/labels/.kind:%20featurerequest","name":".kind: featurerequest","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-01-27T00:42:58Z","updated_at":"2015-01-30T18:13:21Z","closed_at":null,"body":"For now fragment/page is defined using an object literal. It makes it hard to work with Typescript, or ES6 classes, or use object oriented approach for pages.\r\n\r\nIt could be great to use a constructor function as a fragment definition."},"comment":{"url":"https://api.github.com/repos/winjs/winjs/issues/comments/72244509","html_url":"https://github.com/winjs/winjs/issues/904#issuecomment-72244509","issue_url":"https://api.github.com/repos/winjs/winjs/issues/904","id":72244509,"user":{"login":"xirzec","id":639216,"avatar_url":"https://avatars.githubusercontent.com/u/639216?v=3","gravatar_id":"","url":"https://api.github.com/users/xirzec","html_url":"https://github.com/xirzec","followers_url":"https://api.github.com/users/xirzec/followers","following_url":"https://api.github.com/users/xirzec/following{/other_user}","gists_url":"https://api.github.com/users/xirzec/gists{/gist_id}","starred_url":"https://api.github.com/users/xirzec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xirzec/subscriptions","organizations_url":"https://api.github.com/users/xirzec/orgs","repos_url":"https://api.github.com/users/xirzec/repos","events_url":"https://api.github.com/users/xirzec/events{/privacy}","received_events_url":"https://api.github.com/users/xirzec/received_events","type":"User","site_admin":false},"created_at":"2015-01-30T18:13:21Z","updated_at":"2015-01-30T18:13:21Z","body":"Technically Pages already come with a datacontext (it's the state passed to the navigation system) so we are more or less in that model today though you don't have to provide anything and it will default to an empty object.\r\n\r\nI think we need to spend more time on revisiting the design of Pages and a better way to encapsulate different app components. In the mean time it seems like you could do a couple things to work around the mixin problem:\r\n\r\n1. Change to having a factory pattern where you have a function assemble the the mixin for you (so you can share functions in a manner similar to prototypical inheritance.)\r\n1. Create a helper function that walks the prototype chain (probably stopping at Object.prototype) to flatten the chain into an object compatible with mixin."}}