{"action":"created","comment":{"url":"https://api.github.com/repos/koute/stdweb/pulls/comments/232087852","pull_request_review_id":173202510,"id":232087852,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMjA4Nzg1Mg==","diff_hunk":"@@ -0,0 +1,62 @@\n+use webcore::value::Reference;\n+webapi::error::TypeError;\n+\n+use webapi::dom_exception::{\n+    NotSupportedError,\n+    SyntaxError\n+};\n+\n+#[cfg(feature = \"experimental_features_which_may_break_on_minor_version_bumps\")]\n+use webcore::promise::{Promise, TypedPromise};\n+\n+/// The CustomElementRegistry interface provides methods for registering custom elements \n+/// and querying registered elements. To get an instance of it, use the window.customElements property. \n+///\n+/// [(JavaScript docs)](hhttps://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry)\n+/// https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry\n+#[derive(Clone, Debug, PartialEq, Eq, ReferenceType)]\n+#[reference(instance_of = \"CustomElementRegistry\")]\n+pub struct CustomElementRegistry(Reference);\n+\n+\n+error_enum_boilerplate! {\n+    /// A enum of the exceptions that CustomElementRegistry.define() may throw\n+    DefineError,\n+    /// A TypeError\n+    TypeError\n+    /// A NotSupportedError\n+    NotSupportedError,\n+    /// A SyntaxError\n+    SyntaxError,\n+}\n+\n+impl CustomElementRegistry {\n+    /// Defines a new custom element\n+    ///\n+    /// [(JavaScript docs)](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define)\n+    /// https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-define\n+    pub fn define( &self, name: &str, constructor: Any) -> Result<(), DefineError> {","path":"src/webapi/custom_elements.rs","position":38,"original_position":38,"commit_id":"51e683cf749127918bfaa44bfd9426af3125a53e","original_commit_id":"51e683cf749127918bfaa44bfd9426af3125a53e","user":{"login":"koute","id":246574,"node_id":"MDQ6VXNlcjI0NjU3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/246574?v=4","gravatar_id":"","url":"https://api.github.com/users/koute","html_url":"https://github.com/koute","followers_url":"https://api.github.com/users/koute/followers","following_url":"https://api.github.com/users/koute/following{/other_user}","gists_url":"https://api.github.com/users/koute/gists{/gist_id}","starred_url":"https://api.github.com/users/koute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koute/subscriptions","organizations_url":"https://api.github.com/users/koute/orgs","repos_url":"https://api.github.com/users/koute/repos","events_url":"https://api.github.com/users/koute/events{/privacy}","received_events_url":"https://api.github.com/users/koute/received_events","type":"User","site_admin":false},"body":"Hmmm.... we currently don't have a type which can represent a constructor. [According to this a constructor it can be detected with some tricks](https://stackoverflow.com/questions/40922531/how-to-check-if-a-javascript-function-is-a-constructor) so I guess we technically could add one?\r\n\r\nYou'd define such a type using the usual `#[derive(ReferenceType)]`, however you would omit the `#[reference(instance_of = \"...\")]` line and instead implement the `InstanceOf` trait yourself, and put the detection code inside of it. (You can take a look at e.g. the definition of the `error_boilerplate!` for an example on how to impl the `InstanceOf`) Then once we have this type you could use it here and in the return type of `get`.","created_at":"2018-11-08T22:43:10Z","updated_at":"2018-11-08T22:55:20Z","html_url":"https://github.com/koute/stdweb/pull/299#discussion_r232087852","pull_request_url":"https://api.github.com/repos/koute/stdweb/pulls/299","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/koute/stdweb/pulls/comments/232087852"},"html":{"href":"https://github.com/koute/stdweb/pull/299#discussion_r232087852"},"pull_request":{"href":"https://api.github.com/repos/koute/stdweb/pulls/299"}}},"pull_request":{"url":"https://api.github.com/repos/koute/stdweb/pulls/299","id":229171631,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5MTcxNjMx","html_url":"https://github.com/koute/stdweb/pull/299","diff_url":"https://github.com/koute/stdweb/pull/299.diff","patch_url":"https://github.com/koute/stdweb/pull/299.patch","issue_url":"https://api.github.com/repos/koute/stdweb/issues/299","number":299,"state":"open","locked":false,"title":"Custom Elements: CustomElementRegistry","user":{"login":"prasannavl","id":559409,"node_id":"MDQ6VXNlcjU1OTQwOQ==","avatar_url":"https://avatars1.githubusercontent.com/u/559409?v=4","gravatar_id":"","url":"https://api.github.com/users/prasannavl","html_url":"https://github.com/prasannavl","followers_url":"https://api.github.com/users/prasannavl/followers","following_url":"https://api.github.com/users/prasannavl/following{/other_user}","gists_url":"https://api.github.com/users/prasannavl/gists{/gist_id}","starred_url":"https://api.github.com/users/prasannavl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prasannavl/subscriptions","organizations_url":"https://api.github.com/users/prasannavl/orgs","repos_url":"https://api.github.com/users/prasannavl/repos","events_url":"https://api.github.com/users/prasannavl/events{/privacy}","received_events_url":"https://api.github.com/users/prasannavl/received_events","type":"User","site_admin":false},"body":"[WIP] Initial impl of `CustomElementRegistry`\r\n\r\nI do have a few questions before completing this:\r\n\r\n1. How exactly do I represent a Constructor here? (https://github.com/koute/stdweb/pull/299/commits/51e683cf749127918bfaa44bfd9426af3125a53e#diff-55e0c9ca42d6126fc52bcae5a9a2bf95R38)\r\n1. Is it okay to unwrap, this? Initially I did a `no_return`, but then added the error type, and as such the `Result<(), Err>`. Does this fit the project conventions? (https://github.com/koute/stdweb/pull/299/commits/51e683cf749127918bfaa44bfd9426af3125a53e#diff-55e0c9ca42d6126fc52bcae5a9a2bf95R41)\r\n1. Again, constructor type. But also, can `Option` be returned. Does this fit the project conventions, or should this be a result with empty error/not found error? What's the best way to represent `undefined` here. (https://github.com/koute/stdweb/pull/299/commits/51e683cf749127918bfaa44bfd9426af3125a53e#diff-55e0c9ca42d6126fc52bcae5a9a2bf95R48)\r\n1. I followed this convention by looking at other implementations, but it is correct to unwrap this? (https://github.com/koute/stdweb/pull/299/commits/51e683cf749127918bfaa44bfd9426af3125a53e#diff-55e0c9ca42d6126fc52bcae5a9a2bf95R59)","created_at":"2018-11-07T21:19:27Z","updated_at":"2018-11-08T22:55:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a345a61e2abf6f2ab302d33d1120717b6e9a398d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/koute/stdweb/pulls/299/commits","review_comments_url":"https://api.github.com/repos/koute/stdweb/pulls/299/comments","review_comment_url":"https://api.github.com/repos/koute/stdweb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/koute/stdweb/issues/299/comments","statuses_url":"https://api.github.com/repos/koute/stdweb/statuses/51e683cf749127918bfaa44bfd9426af3125a53e","head":{"label":"prasannavl:patch-1","ref":"patch-1","sha":"51e683cf749127918bfaa44bfd9426af3125a53e","user":{"login":"prasannavl","id":559409,"node_id":"MDQ6VXNlcjU1OTQwOQ==","avatar_url":"https://avatars1.githubusercontent.com/u/559409?v=4","gravatar_id":"","url":"https://api.github.com/users/prasannavl","html_url":"https://github.com/prasannavl","followers_url":"https://api.github.com/users/prasannavl/followers","following_url":"https://api.github.com/users/prasannavl/following{/other_user}","gists_url":"https://api.github.com/users/prasannavl/gists{/gist_id}","starred_url":"https://api.github.com/users/prasannavl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prasannavl/subscriptions","organizations_url":"https://api.github.com/users/prasannavl/orgs","repos_url":"https://api.github.com/users/prasannavl/repos","events_url":"https://api.github.com/users/prasannavl/events{/privacy}","received_events_url":"https://api.github.com/users/prasannavl/received_events","type":"User","site_admin":false},"repo":{"id":156608668,"node_id":"MDEwOlJlcG9zaXRvcnkxNTY2MDg2Njg=","name":"stdweb","full_name":"prasannavl/stdweb","private":false,"owner":{"login":"prasannavl","id":559409,"node_id":"MDQ6VXNlcjU1OTQwOQ==","avatar_url":"https://avatars1.githubusercontent.com/u/559409?v=4","gravatar_id":"","url":"https://api.github.com/users/prasannavl","html_url":"https://github.com/prasannavl","followers_url":"https://api.github.com/users/prasannavl/followers","following_url":"https://api.github.com/users/prasannavl/following{/other_user}","gists_url":"https://api.github.com/users/prasannavl/gists{/gist_id}","starred_url":"https://api.github.com/users/prasannavl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prasannavl/subscriptions","organizations_url":"https://api.github.com/users/prasannavl/orgs","repos_url":"https://api.github.com/users/prasannavl/repos","events_url":"https://api.github.com/users/prasannavl/events{/privacy}","received_events_url":"https://api.github.com/users/prasannavl/received_events","type":"User","site_admin":false},"html_url":"https://github.com/prasannavl/stdweb","description":"A standard library for the client-side Web","fork":true,"url":"https://api.github.com/repos/prasannavl/stdweb","forks_url":"https://api.github.com/repos/prasannavl/stdweb/forks","keys_url":"https://api.github.com/repos/prasannavl/stdweb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prasannavl/stdweb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prasannavl/stdweb/teams","hooks_url":"https://api.github.com/repos/prasannavl/stdweb/hooks","issue_events_url":"https://api.github.com/repos/prasannavl/stdweb/issues/events{/number}","events_url":"https://api.github.com/repos/prasannavl/stdweb/events","assignees_url":"https://api.github.com/repos/prasannavl/stdweb/assignees{/user}","branches_url":"https://api.github.com/repos/prasannavl/stdweb/branches{/branch}","tags_url":"https://api.github.com/repos/prasannavl/stdweb/tags","blobs_url":"https://api.github.com/repos/prasannavl/stdweb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prasannavl/stdweb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prasannavl/stdweb/git/refs{/sha}","trees_url":"https://api.github.com/repos/prasannavl/stdweb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prasannavl/stdweb/statuses/{sha}","languages_url":"https://api.github.com/repos/prasannavl/stdweb/languages","stargazers_url":"https://api.github.com/repos/prasannavl/stdweb/stargazers","contributors_url":"https://api.github.com/repos/prasannavl/stdweb/contributors","subscribers_url":"https://api.github.com/repos/prasannavl/stdweb/subscribers","subscription_url":"https://api.github.com/repos/prasannavl/stdweb/subscription","commits_url":"https://api.github.com/repos/prasannavl/stdweb/commits{/sha}","git_commits_url":"https://api.github.com/repos/prasannavl/stdweb/git/commits{/sha}","comments_url":"https://api.github.com/repos/prasannavl/stdweb/comments{/number}","issue_comment_url":"https://api.github.com/repos/prasannavl/stdweb/issues/comments{/number}","contents_url":"https://api.github.com/repos/prasannavl/stdweb/contents/{+path}","compare_url":"https://api.github.com/repos/prasannavl/stdweb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prasannavl/stdweb/merges","archive_url":"https://api.github.com/repos/prasannavl/stdweb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prasannavl/stdweb/downloads","issues_url":"https://api.github.com/repos/prasannavl/stdweb/issues{/number}","pulls_url":"https://api.github.com/repos/prasannavl/stdweb/pulls{/number}","milestones_url":"https://api.github.com/repos/prasannavl/stdweb/milestones{/number}","notifications_url":"https://api.github.com/repos/prasannavl/stdweb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prasannavl/stdweb/labels{/name}","releases_url":"https://api.github.com/repos/prasannavl/stdweb/releases{/id}","deployments_url":"https://api.github.com/repos/prasannavl/stdweb/deployments","created_at":"2018-11-07T21:11:32Z","updated_at":"2018-11-07T21:11:34Z","pushed_at":"2018-11-07T21:14:14Z","git_url":"git://github.com/prasannavl/stdweb.git","ssh_url":"git@github.com:prasannavl/stdweb.git","clone_url":"https://github.com/prasannavl/stdweb.git","svn_url":"https://github.com/prasannavl/stdweb","homepage":"","size":819,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"koute:master","ref":"master","sha":"fb93062bf5013c3fbfabfea64d286af34e338fc7","user":{"login":"koute","id":246574,"node_id":"MDQ6VXNlcjI0NjU3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/246574?v=4","gravatar_id":"","url":"https://api.github.com/users/koute","html_url":"https://github.com/koute","followers_url":"https://api.github.com/users/koute/followers","following_url":"https://api.github.com/users/koute/following{/other_user}","gists_url":"https://api.github.com/users/koute/gists{/gist_id}","starred_url":"https://api.github.com/users/koute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koute/subscriptions","organizations_url":"https://api.github.com/users/koute/orgs","repos_url":"https://api.github.com/users/koute/repos","events_url":"https://api.github.com/users/koute/events{/privacy}","received_events_url":"https://api.github.com/users/koute/received_events","type":"User","site_admin":false},"repo":{"id":84753809,"node_id":"MDEwOlJlcG9zaXRvcnk4NDc1MzgwOQ==","name":"stdweb","full_name":"koute/stdweb","private":false,"owner":{"login":"koute","id":246574,"node_id":"MDQ6VXNlcjI0NjU3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/246574?v=4","gravatar_id":"","url":"https://api.github.com/users/koute","html_url":"https://github.com/koute","followers_url":"https://api.github.com/users/koute/followers","following_url":"https://api.github.com/users/koute/following{/other_user}","gists_url":"https://api.github.com/users/koute/gists{/gist_id}","starred_url":"https://api.github.com/users/koute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koute/subscriptions","organizations_url":"https://api.github.com/users/koute/orgs","repos_url":"https://api.github.com/users/koute/repos","events_url":"https://api.github.com/users/koute/events{/privacy}","received_events_url":"https://api.github.com/users/koute/received_events","type":"User","site_admin":false},"html_url":"https://github.com/koute/stdweb","description":"A standard library for the client-side Web","fork":false,"url":"https://api.github.com/repos/koute/stdweb","forks_url":"https://api.github.com/repos/koute/stdweb/forks","keys_url":"https://api.github.com/repos/koute/stdweb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/koute/stdweb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/koute/stdweb/teams","hooks_url":"https://api.github.com/repos/koute/stdweb/hooks","issue_events_url":"https://api.github.com/repos/koute/stdweb/issues/events{/number}","events_url":"https://api.github.com/repos/koute/stdweb/events","assignees_url":"https://api.github.com/repos/koute/stdweb/assignees{/user}","branches_url":"https://api.github.com/repos/koute/stdweb/branches{/branch}","tags_url":"https://api.github.com/repos/koute/stdweb/tags","blobs_url":"https://api.github.com/repos/koute/stdweb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/koute/stdweb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/koute/stdweb/git/refs{/sha}","trees_url":"https://api.github.com/repos/koute/stdweb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/koute/stdweb/statuses/{sha}","languages_url":"https://api.github.com/repos/koute/stdweb/languages","stargazers_url":"https://api.github.com/repos/koute/stdweb/stargazers","contributors_url":"https://api.github.com/repos/koute/stdweb/contributors","subscribers_url":"https://api.github.com/repos/koute/stdweb/subscribers","subscription_url":"https://api.github.com/repos/koute/stdweb/subscription","commits_url":"https://api.github.com/repos/koute/stdweb/commits{/sha}","git_commits_url":"https://api.github.com/repos/koute/stdweb/git/commits{/sha}","comments_url":"https://api.github.com/repos/koute/stdweb/comments{/number}","issue_comment_url":"https://api.github.com/repos/koute/stdweb/issues/comments{/number}","contents_url":"https://api.github.com/repos/koute/stdweb/contents/{+path}","compare_url":"https://api.github.com/repos/koute/stdweb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/koute/stdweb/merges","archive_url":"https://api.github.com/repos/koute/stdweb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/koute/stdweb/downloads","issues_url":"https://api.github.com/repos/koute/stdweb/issues{/number}","pulls_url":"https://api.github.com/repos/koute/stdweb/pulls{/number}","milestones_url":"https://api.github.com/repos/koute/stdweb/milestones{/number}","notifications_url":"https://api.github.com/repos/koute/stdweb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/koute/stdweb/labels{/name}","releases_url":"https://api.github.com/repos/koute/stdweb/releases{/id}","deployments_url":"https://api.github.com/repos/koute/stdweb/deployments","created_at":"2017-03-12T20:07:37Z","updated_at":"2018-11-08T22:31:08Z","pushed_at":"2018-11-07T21:19:28Z","git_url":"git://github.com/koute/stdweb.git","ssh_url":"git@github.com:koute/stdweb.git","clone_url":"https://github.com/koute/stdweb.git","svn_url":"https://github.com/koute/stdweb","homepage":"","size":815,"stargazers_count":2168,"watchers_count":2168,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":120,"mirror_url":null,"archived":false,"open_issues_count":70,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":120,"open_issues":70,"watchers":2168,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/koute/stdweb/pulls/299"},"html":{"href":"https://github.com/koute/stdweb/pull/299"},"issue":{"href":"https://api.github.com/repos/koute/stdweb/issues/299"},"comments":{"href":"https://api.github.com/repos/koute/stdweb/issues/299/comments"},"review_comments":{"href":"https://api.github.com/repos/koute/stdweb/pulls/299/comments"},"review_comment":{"href":"https://api.github.com/repos/koute/stdweb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/koute/stdweb/pulls/299/commits"},"statuses":{"href":"https://api.github.com/repos/koute/stdweb/statuses/51e683cf749127918bfaa44bfd9426af3125a53e"}},"author_association":"NONE"}}
{"actor":{"display_login":"koute"}}