{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Blazor/issues/688","repository_url":"https://api.github.com/repos/aspnet/Blazor","labels_url":"https://api.github.com/repos/aspnet/Blazor/issues/688/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Blazor/issues/688/comments","events_url":"https://api.github.com/repos/aspnet/Blazor/issues/688/events","html_url":"https://github.com/aspnet/Blazor/issues/688","id":318141013,"number":688,"title":"Expose getRegisteredFunctions from Blazor javascript module","user":{"login":"alexfdezsauco","id":1785664,"avatar_url":"https://avatars1.githubusercontent.com/u/1785664?v=4","gravatar_id":"","url":"https://api.github.com/users/alexfdezsauco","html_url":"https://github.com/alexfdezsauco","followers_url":"https://api.github.com/users/alexfdezsauco/followers","following_url":"https://api.github.com/users/alexfdezsauco/following{/other_user}","gists_url":"https://api.github.com/users/alexfdezsauco/gists{/gist_id}","starred_url":"https://api.github.com/users/alexfdezsauco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexfdezsauco/subscriptions","organizations_url":"https://api.github.com/users/alexfdezsauco/orgs","repos_url":"https://api.github.com/users/alexfdezsauco/repos","events_url":"https://api.github.com/users/alexfdezsauco/events{/privacy}","received_events_url":"https://api.github.com/users/alexfdezsauco/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-26T18:12:35Z","updated_at":"2018-04-27T20:12:48Z","closed_at":"2018-04-26T21:03:07Z","author_association":"NONE","body":"Should be possible expose the getRegisteredFunctions from Blazor javascript module.\r\n\r\nThis could be useful in custom interop solutions like this one for promises:\r\n\r\nhttps://joonasw.net/view/csharp-await-and-js-promises-in-blazor\r\n\r\ndoesn't require 'host' the functions in the window object. Just use the same approach to register the function to be called.\r\n\r\nThe implementation could be this one:\r\n\r\n`let promise = Blazor.getRegisteredFunction(fnName)(data)`\r\n\r\ninstead this one:\r\n\r\n`let promise = window[fnName](data);`\r\n\r\nBWT, could Blazor include a solution like this one https://joonasw.net/view/csharp-await-and-js-promises-in-blazor to call promise (async/await)."},"comment":{"url":"https://api.github.com/repos/aspnet/Blazor/issues/comments/385081570","html_url":"https://github.com/aspnet/Blazor/issues/688#issuecomment-385081570","issue_url":"https://api.github.com/repos/aspnet/Blazor/issues/688","id":385081570,"user":{"login":"alexfdezsauco","id":1785664,"avatar_url":"https://avatars1.githubusercontent.com/u/1785664?v=4","gravatar_id":"","url":"https://api.github.com/users/alexfdezsauco","html_url":"https://github.com/alexfdezsauco","followers_url":"https://api.github.com/users/alexfdezsauco/followers","following_url":"https://api.github.com/users/alexfdezsauco/following{/other_user}","gists_url":"https://api.github.com/users/alexfdezsauco/gists{/gist_id}","starred_url":"https://api.github.com/users/alexfdezsauco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexfdezsauco/subscriptions","organizations_url":"https://api.github.com/users/alexfdezsauco/orgs","repos_url":"https://api.github.com/users/alexfdezsauco/repos","events_url":"https://api.github.com/users/alexfdezsauco/events{/privacy}","received_events_url":"https://api.github.com/users/alexfdezsauco/received_events","type":"User","site_admin":false},"created_at":"2018-04-27T20:12:48Z","updated_at":"2018-04-27T20:12:48Z","author_association":"NONE","body":"I understand your point in some way, but `Razor.registerFunction` is public, but I have no way to find a registered function for custom function invoke approach. That is the reason why I requested also make public 'getRegisteredFunction' (the function exists but is not exposed) in order to use the same approach to register a function.\r\n\r\n`Razor.registerFunction('PromiseFunction', function() {\r\n   return new Promise(resolve, reject) {\r\n           ......\r\n   };\r\n})`\r\n\r\nthen anyone can find or discover such function\r\n\r\n`var promiseFunction = Razor.getRegisteredFunction('PromiseFunction')`"}}
{"actor":{"display_login":"alexfdezsauco"}}