{"action":"created","comment":{"url":"https://api.github.com/repos/PolymerLabs/actor-helpers/pulls/comments/236728648","pull_request_review_id":178863398,"id":236728648,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNjcyODY0OA==","diff_hunk":"@@ -42,6 +42,122 @@ declare global {\n  */\n export type ValidActorMessageName = keyof ActorMessageType;\n \n+export interface actorMixin<T> {\n+  actorName?: ValidActorMessageName;\n+  onMessage(message: T): void;\n+}\n+\n+interface Constructable<T = {}> {\n+  new (...args: any[]): T;\n+  prototype: T;\n+}\n+\n+/**\n+ * A mixin function to define an Actor type. It creates a class with a stub\n+ * for the {@link Actor#onMessage} callback, which must be overwritten.\n+ *\n+ *    const Actor = actorMixin<MessageType>(SuperClassConstructor);\n+ *    class MyActor extends Actor {\n+ *      onMessage(message: MessageType) {\n+ *        console.log(`Actor ${this.actorName} I received message: ${message}`);\n+ *      }\n+ *    }\n+ *\n+ * If you would like to perform some initialization logic, implement the\n+ * optional {@link Actor#init} callback.\n+ *\n+ *    const Actor = actorMixin<MessageType>(SuperClassConstructor);\n+ *    class MyActor extends Actor {\n+ *      stockData?: StockData;\n+ *      count?: number;\n+ *\n+ *      async init() {\n+ *        this.count = 0;\n+ *        this.stockData = await (await fetch(\"/stockdata.json\")).json()\n+ *      }\n+ *\n+ *      onMessage(message: MessageType) {\n+ *        this.count!++;\n+ *        console.log(`Actor ${this.actorName} received message number ${this.count}: ${message}`);\n+ *      }\n+ *    }\n+ *\n+ * If you want to know the actorName that this actor is assigned to in your\n+ * application, you can use `actorName`. This field is accessible only after\n+ * the {@link hookup} has been called.\n+ *\n+ * Users of this mixin generally should not use {@link Actor#initPromise}. This\n+ * is an internal implementation detail for {@link hookup}.\n+ */\n+export function actorMixin<T, S extends Constructable = Constructable<Object>>(\n+  superClass: S\n+) {\n+  class actor extends superClass {","path":"src/actor/Actor.ts","position":54,"original_position":54,"commit_id":"4f886d342f13f32c5aa7ca012bde52c71432667e","original_commit_id":"4f886d342f13f32c5aa7ca012bde52c71432667e","user":{"login":"TimvdLippe","id":5948271,"node_id":"MDQ6VXNlcjU5NDgyNzE=","avatar_url":"https://avatars3.githubusercontent.com/u/5948271?v=4","gravatar_id":"","url":"https://api.github.com/users/TimvdLippe","html_url":"https://github.com/TimvdLippe","followers_url":"https://api.github.com/users/TimvdLippe/followers","following_url":"https://api.github.com/users/TimvdLippe/following{/other_user}","gists_url":"https://api.github.com/users/TimvdLippe/gists{/gist_id}","starred_url":"https://api.github.com/users/TimvdLippe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimvdLippe/subscriptions","organizations_url":"https://api.github.com/users/TimvdLippe/orgs","repos_url":"https://api.github.com/users/TimvdLippe/repos","events_url":"https://api.github.com/users/TimvdLippe/events{/privacy}","received_events_url":"https://api.github.com/users/TimvdLippe/received_events","type":"User","site_admin":false},"body":"Nit: can be `return class extends superClass`","created_at":"2018-11-27T15:57:29Z","updated_at":"2018-11-27T15:59:19Z","html_url":"https://github.com/PolymerLabs/actor-helpers/pull/35#discussion_r236728648","pull_request_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/pulls/35","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/PolymerLabs/actor-helpers/pulls/comments/236728648"},"html":{"href":"https://github.com/PolymerLabs/actor-helpers/pull/35#discussion_r236728648"},"pull_request":{"href":"https://api.github.com/repos/PolymerLabs/actor-helpers/pulls/35"}}},"pull_request":{"url":"https://api.github.com/repos/PolymerLabs/actor-helpers/pulls/35","id":233958946,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMzOTU4OTQ2","html_url":"https://github.com/PolymerLabs/actor-helpers/pull/35","diff_url":"https://github.com/PolymerLabs/actor-helpers/pull/35.diff","patch_url":"https://github.com/PolymerLabs/actor-helpers/pull/35.patch","issue_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/issues/35","number":35,"state":"open","locked":false,"title":"Converts Actor base class to a mixin","user":{"login":"paullewis","id":617438,"node_id":"MDQ6VXNlcjYxNzQzOA==","avatar_url":"https://avatars2.githubusercontent.com/u/617438?v=4","gravatar_id":"","url":"https://api.github.com/users/paullewis","html_url":"https://github.com/paullewis","followers_url":"https://api.github.com/users/paullewis/followers","following_url":"https://api.github.com/users/paullewis/following{/other_user}","gists_url":"https://api.github.com/users/paullewis/gists{/gist_id}","starred_url":"https://api.github.com/users/paullewis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paullewis/subscriptions","organizations_url":"https://api.github.com/users/paullewis/orgs","repos_url":"https://api.github.com/users/paullewis/repos","events_url":"https://api.github.com/users/paullewis/events{/privacy}","received_events_url":"https://api.github.com/users/paullewis/received_events","type":"User","site_admin":false},"body":"The changes are in Actor.ts and Actor_test.ts. Everything else is a build artifact.","created_at":"2018-11-27T15:40:38Z","updated_at":"2018-11-27T15:59:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f59e27a0d515e374ca590ec2e27531ce760f08aa","assignee":null,"assignees":[],"requested_reviewers":[{"login":"surma","id":234957,"node_id":"MDQ6VXNlcjIzNDk1Nw==","avatar_url":"https://avatars1.githubusercontent.com/u/234957?v=4","gravatar_id":"","url":"https://api.github.com/users/surma","html_url":"https://github.com/surma","followers_url":"https://api.github.com/users/surma/followers","following_url":"https://api.github.com/users/surma/following{/other_user}","gists_url":"https://api.github.com/users/surma/gists{/gist_id}","starred_url":"https://api.github.com/users/surma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/surma/subscriptions","organizations_url":"https://api.github.com/users/surma/orgs","repos_url":"https://api.github.com/users/surma/repos","events_url":"https://api.github.com/users/surma/events{/privacy}","received_events_url":"https://api.github.com/users/surma/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/pulls/35/commits","review_comments_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/pulls/35/comments","review_comment_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/issues/35/comments","statuses_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/statuses/4f886d342f13f32c5aa7ca012bde52c71432667e","head":{"label":"PolymerLabs:mixin","ref":"mixin","sha":"4f886d342f13f32c5aa7ca012bde52c71432667e","user":{"login":"PolymerLabs","id":5912903,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5MTI5MDM=","avatar_url":"https://avatars2.githubusercontent.com/u/5912903?v=4","gravatar_id":"","url":"https://api.github.com/users/PolymerLabs","html_url":"https://github.com/PolymerLabs","followers_url":"https://api.github.com/users/PolymerLabs/followers","following_url":"https://api.github.com/users/PolymerLabs/following{/other_user}","gists_url":"https://api.github.com/users/PolymerLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/PolymerLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PolymerLabs/subscriptions","organizations_url":"https://api.github.com/users/PolymerLabs/orgs","repos_url":"https://api.github.com/users/PolymerLabs/repos","events_url":"https://api.github.com/users/PolymerLabs/events{/privacy}","received_events_url":"https://api.github.com/users/PolymerLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":149120089,"node_id":"MDEwOlJlcG9zaXRvcnkxNDkxMjAwODk=","name":"actor-helpers","full_name":"PolymerLabs/actor-helpers","private":false,"owner":{"login":"PolymerLabs","id":5912903,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5MTI5MDM=","avatar_url":"https://avatars2.githubusercontent.com/u/5912903?v=4","gravatar_id":"","url":"https://api.github.com/users/PolymerLabs","html_url":"https://github.com/PolymerLabs","followers_url":"https://api.github.com/users/PolymerLabs/followers","following_url":"https://api.github.com/users/PolymerLabs/following{/other_user}","gists_url":"https://api.github.com/users/PolymerLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/PolymerLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PolymerLabs/subscriptions","organizations_url":"https://api.github.com/users/PolymerLabs/orgs","repos_url":"https://api.github.com/users/PolymerLabs/repos","events_url":"https://api.github.com/users/PolymerLabs/events{/privacy}","received_events_url":"https://api.github.com/users/PolymerLabs/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/PolymerLabs/actor-helpers","description":null,"fork":false,"url":"https://api.github.com/repos/PolymerLabs/actor-helpers","forks_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/forks","keys_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/teams","hooks_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/hooks","issue_events_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/issues/events{/number}","events_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/events","assignees_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/assignees{/user}","branches_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/branches{/branch}","tags_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/tags","blobs_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/git/refs{/sha}","trees_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/statuses/{sha}","languages_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/languages","stargazers_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/stargazers","contributors_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/contributors","subscribers_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/subscribers","subscription_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/subscription","commits_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/commits{/sha}","git_commits_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/git/commits{/sha}","comments_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/comments{/number}","issue_comment_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/issues/comments{/number}","contents_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/contents/{+path}","compare_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/merges","archive_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/downloads","issues_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/issues{/number}","pulls_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/pulls{/number}","milestones_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/milestones{/number}","notifications_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/labels{/name}","releases_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/releases{/id}","deployments_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/deployments","created_at":"2018-09-17T12:14:08Z","updated_at":"2018-11-25T23:43:05Z","pushed_at":"2018-11-27T15:55:55Z","git_url":"git://github.com/PolymerLabs/actor-helpers.git","ssh_url":"git@github.com:PolymerLabs/actor-helpers.git","clone_url":"https://github.com/PolymerLabs/actor-helpers.git","svn_url":"https://github.com/PolymerLabs/actor-helpers","homepage":null,"size":269,"stargazers_count":19,"watchers_count":19,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":1,"watchers":19,"default_branch":"master"}},"base":{"label":"PolymerLabs:master","ref":"master","sha":"0c61eb2047845b7447712cca8adf8dd8b481a6b0","user":{"login":"PolymerLabs","id":5912903,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5MTI5MDM=","avatar_url":"https://avatars2.githubusercontent.com/u/5912903?v=4","gravatar_id":"","url":"https://api.github.com/users/PolymerLabs","html_url":"https://github.com/PolymerLabs","followers_url":"https://api.github.com/users/PolymerLabs/followers","following_url":"https://api.github.com/users/PolymerLabs/following{/other_user}","gists_url":"https://api.github.com/users/PolymerLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/PolymerLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PolymerLabs/subscriptions","organizations_url":"https://api.github.com/users/PolymerLabs/orgs","repos_url":"https://api.github.com/users/PolymerLabs/repos","events_url":"https://api.github.com/users/PolymerLabs/events{/privacy}","received_events_url":"https://api.github.com/users/PolymerLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":149120089,"node_id":"MDEwOlJlcG9zaXRvcnkxNDkxMjAwODk=","name":"actor-helpers","full_name":"PolymerLabs/actor-helpers","private":false,"owner":{"login":"PolymerLabs","id":5912903,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5MTI5MDM=","avatar_url":"https://avatars2.githubusercontent.com/u/5912903?v=4","gravatar_id":"","url":"https://api.github.com/users/PolymerLabs","html_url":"https://github.com/PolymerLabs","followers_url":"https://api.github.com/users/PolymerLabs/followers","following_url":"https://api.github.com/users/PolymerLabs/following{/other_user}","gists_url":"https://api.github.com/users/PolymerLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/PolymerLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PolymerLabs/subscriptions","organizations_url":"https://api.github.com/users/PolymerLabs/orgs","repos_url":"https://api.github.com/users/PolymerLabs/repos","events_url":"https://api.github.com/users/PolymerLabs/events{/privacy}","received_events_url":"https://api.github.com/users/PolymerLabs/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/PolymerLabs/actor-helpers","description":null,"fork":false,"url":"https://api.github.com/repos/PolymerLabs/actor-helpers","forks_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/forks","keys_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/teams","hooks_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/hooks","issue_events_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/issues/events{/number}","events_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/events","assignees_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/assignees{/user}","branches_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/branches{/branch}","tags_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/tags","blobs_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/git/refs{/sha}","trees_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/statuses/{sha}","languages_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/languages","stargazers_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/stargazers","contributors_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/contributors","subscribers_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/subscribers","subscription_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/subscription","commits_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/commits{/sha}","git_commits_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/git/commits{/sha}","comments_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/comments{/number}","issue_comment_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/issues/comments{/number}","contents_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/contents/{+path}","compare_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/merges","archive_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/downloads","issues_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/issues{/number}","pulls_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/pulls{/number}","milestones_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/milestones{/number}","notifications_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/labels{/name}","releases_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/releases{/id}","deployments_url":"https://api.github.com/repos/PolymerLabs/actor-helpers/deployments","created_at":"2018-09-17T12:14:08Z","updated_at":"2018-11-25T23:43:05Z","pushed_at":"2018-11-27T15:55:55Z","git_url":"git://github.com/PolymerLabs/actor-helpers.git","ssh_url":"git@github.com:PolymerLabs/actor-helpers.git","clone_url":"https://github.com/PolymerLabs/actor-helpers.git","svn_url":"https://github.com/PolymerLabs/actor-helpers","homepage":null,"size":269,"stargazers_count":19,"watchers_count":19,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":1,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PolymerLabs/actor-helpers/pulls/35"},"html":{"href":"https://github.com/PolymerLabs/actor-helpers/pull/35"},"issue":{"href":"https://api.github.com/repos/PolymerLabs/actor-helpers/issues/35"},"comments":{"href":"https://api.github.com/repos/PolymerLabs/actor-helpers/issues/35/comments"},"review_comments":{"href":"https://api.github.com/repos/PolymerLabs/actor-helpers/pulls/35/comments"},"review_comment":{"href":"https://api.github.com/repos/PolymerLabs/actor-helpers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PolymerLabs/actor-helpers/pulls/35/commits"},"statuses":{"href":"https://api.github.com/repos/PolymerLabs/actor-helpers/statuses/4f886d342f13f32c5aa7ca012bde52c71432667e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"TimvdLippe"}}