{"action":"created","comment":{"url":"https://api.github.com/repos/jupyter/jupyter-js-services/pulls/comments/38055546","id":38055546,"diff_hunk":"@@ -72,3 +72,96 @@ Earlier versions may also work, but come with no guarantees.\n \n Usage Examples\n --------------\n+\n+**Note:** This module is fully compatible with Node/Babel/ES6/ES5. Simply\n+omit the type declarations when using a language other than TypeScript.\n+\n+**Kernel**\n+\n+```typescript\n+import {\n+  IKernelFuture, IKernelId, IKernelInfo, IKernelMsg, Kernel\n+} from 'jupyter-js-services';\n+\n+// get a list of available sessions\n+var listPromise = Kernel.list('http://localhost:8000');\n+\n+// start a specific session\n+var kernel = NotebookSession('http://localhost:8000');\n+listPromise.then((kernelList: IKernelId[]) => {\n+  kernel.start(kernelList[0]);\n+});\n+\n+// send a message and get replies\n+kernel.onReady.then(() => {\n+  var future: IKernelFuture = kernel.execute('a = 1');\n+  future.onDone(() => {\n+    console.log('Future is fulfilled');\n+  });\n+  future.onOutput((msg: IKernelMsg) => {\n+    console.log(msg.content);  // rich output data\n+  });\n+});\n+\n+// restart the kernel and send an inspect message\n+kernel.restart().then(() => {\n+  var future = kernel.inspect('hello', 5);\n+  future.onReply((msg: IKernelMsg) => {","path":"README.md","position":38,"original_position":38,"commit_id":"ab025fb95de5daf204a568bebc9d8ff3a1219eaa","original_commit_id":"ab025fb95de5daf204a568bebc9d8ff3a1219eaa","user":{"login":"sccolbert","id":137289,"avatar_url":"https://avatars.githubusercontent.com/u/137289?v=3","gravatar_id":"","url":"https://api.github.com/users/sccolbert","html_url":"https://github.com/sccolbert","followers_url":"https://api.github.com/users/sccolbert/followers","following_url":"https://api.github.com/users/sccolbert/following{/other_user}","gists_url":"https://api.github.com/users/sccolbert/gists{/gist_id}","starred_url":"https://api.github.com/users/sccolbert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sccolbert/subscriptions","organizations_url":"https://api.github.com/users/sccolbert/orgs","repos_url":"https://api.github.com/users/sccolbert/repos","events_url":"https://api.github.com/users/sccolbert/events{/privacy}","received_events_url":"https://api.github.com/users/sccolbert/received_events","type":"User","site_admin":false},"body":"`msg` can be contextually typed","created_at":"2015-08-27T01:51:40Z","updated_at":"2015-08-27T01:51:40Z","html_url":"https://github.com/jupyter/jupyter-js-services/pull/20#discussion_r38055546","pull_request_url":"https://api.github.com/repos/jupyter/jupyter-js-services/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/jupyter/jupyter-js-services/pulls/comments/38055546"},"html":{"href":"https://github.com/jupyter/jupyter-js-services/pull/20#discussion_r38055546"},"pull_request":{"href":"https://api.github.com/repos/jupyter/jupyter-js-services/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/jupyter/jupyter-js-services/pulls/20","id":43323429,"html_url":"https://github.com/jupyter/jupyter-js-services/pull/20","diff_url":"https://github.com/jupyter/jupyter-js-services/pull/20.diff","patch_url":"https://github.com/jupyter/jupyter-js-services/pull/20.patch","issue_url":"https://api.github.com/repos/jupyter/jupyter-js-services/issues/20","number":20,"state":"open","locked":false,"title":"Add an onReady Promise for Services","user":{"login":"blink1073","id":2096628,"avatar_url":"https://avatars.githubusercontent.com/u/2096628?v=3","gravatar_id":"","url":"https://api.github.com/users/blink1073","html_url":"https://github.com/blink1073","followers_url":"https://api.github.com/users/blink1073/followers","following_url":"https://api.github.com/users/blink1073/following{/other_user}","gists_url":"https://api.github.com/users/blink1073/gists{/gist_id}","starred_url":"https://api.github.com/users/blink1073/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blink1073/subscriptions","organizations_url":"https://api.github.com/users/blink1073/orgs","repos_url":"https://api.github.com/users/blink1073/repos","events_url":"https://api.github.com/users/blink1073/events{/privacy}","received_events_url":"https://api.github.com/users/blink1073/received_events","type":"User","site_admin":false},"body":"- Unify the classes in Services to expose a Promise called `onReady` that is fulfilled when the service is ready, which is a Service-dependent condition.\r\n- A Kernel is ready when it gets a valid `kernel_info_reply` from the kernel over the WebSocket.\r\n- A Session is ready when its kernel is ready.\r\n- This will also be applied to the other services in the open PRs.\r\n- Also switches to a leaner packaging system with specified package files.\r\n\r\n- API example [docs](https://github.com/blink1073/jupyter-js-services/blob/promises_promises/README.md#usage-examples).","created_at":"2015-08-25T19:02:12Z","updated_at":"2015-08-27T01:51:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"896ee7dd25a559f71240adb0e5e4d39d04a2e226","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jupyter/jupyter-js-services/pulls/20/commits","review_comments_url":"https://api.github.com/repos/jupyter/jupyter-js-services/pulls/20/comments","review_comment_url":"https://api.github.com/repos/jupyter/jupyter-js-services/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jupyter/jupyter-js-services/issues/20/comments","statuses_url":"https://api.github.com/repos/jupyter/jupyter-js-services/statuses/ab025fb95de5daf204a568bebc9d8ff3a1219eaa","head":{"label":"blink1073:promises_promises","ref":"promises_promises","sha":"ab025fb95de5daf204a568bebc9d8ff3a1219eaa","user":{"login":"blink1073","id":2096628,"avatar_url":"https://avatars.githubusercontent.com/u/2096628?v=3","gravatar_id":"","url":"https://api.github.com/users/blink1073","html_url":"https://github.com/blink1073","followers_url":"https://api.github.com/users/blink1073/followers","following_url":"https://api.github.com/users/blink1073/following{/other_user}","gists_url":"https://api.github.com/users/blink1073/gists{/gist_id}","starred_url":"https://api.github.com/users/blink1073/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blink1073/subscriptions","organizations_url":"https://api.github.com/users/blink1073/orgs","repos_url":"https://api.github.com/users/blink1073/repos","events_url":"https://api.github.com/users/blink1073/events{/privacy}","received_events_url":"https://api.github.com/users/blink1073/received_events","type":"User","site_admin":false},"repo":{"id":40366391,"name":"jupyter-js-services","full_name":"blink1073/jupyter-js-services","owner":{"login":"blink1073","id":2096628,"avatar_url":"https://avatars.githubusercontent.com/u/2096628?v=3","gravatar_id":"","url":"https://api.github.com/users/blink1073","html_url":"https://github.com/blink1073","followers_url":"https://api.github.com/users/blink1073/followers","following_url":"https://api.github.com/users/blink1073/following{/other_user}","gists_url":"https://api.github.com/users/blink1073/gists{/gist_id}","starred_url":"https://api.github.com/users/blink1073/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blink1073/subscriptions","organizations_url":"https://api.github.com/users/blink1073/orgs","repos_url":"https://api.github.com/users/blink1073/repos","events_url":"https://api.github.com/users/blink1073/events{/privacy}","received_events_url":"https://api.github.com/users/blink1073/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/blink1073/jupyter-js-services","description":"Javascript client APIs for the Jupyter services REST APIs","fork":true,"url":"https://api.github.com/repos/blink1073/jupyter-js-services","forks_url":"https://api.github.com/repos/blink1073/jupyter-js-services/forks","keys_url":"https://api.github.com/repos/blink1073/jupyter-js-services/keys{/key_id}","collaborators_url":"https://api.github.com/repos/blink1073/jupyter-js-services/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/blink1073/jupyter-js-services/teams","hooks_url":"https://api.github.com/repos/blink1073/jupyter-js-services/hooks","issue_events_url":"https://api.github.com/repos/blink1073/jupyter-js-services/issues/events{/number}","events_url":"https://api.github.com/repos/blink1073/jupyter-js-services/events","assignees_url":"https://api.github.com/repos/blink1073/jupyter-js-services/assignees{/user}","branches_url":"https://api.github.com/repos/blink1073/jupyter-js-services/branches{/branch}","tags_url":"https://api.github.com/repos/blink1073/jupyter-js-services/tags","blobs_url":"https://api.github.com/repos/blink1073/jupyter-js-services/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/blink1073/jupyter-js-services/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/blink1073/jupyter-js-services/git/refs{/sha}","trees_url":"https://api.github.com/repos/blink1073/jupyter-js-services/git/trees{/sha}","statuses_url":"https://api.github.com/repos/blink1073/jupyter-js-services/statuses/{sha}","languages_url":"https://api.github.com/repos/blink1073/jupyter-js-services/languages","stargazers_url":"https://api.github.com/repos/blink1073/jupyter-js-services/stargazers","contributors_url":"https://api.github.com/repos/blink1073/jupyter-js-services/contributors","subscribers_url":"https://api.github.com/repos/blink1073/jupyter-js-services/subscribers","subscription_url":"https://api.github.com/repos/blink1073/jupyter-js-services/subscription","commits_url":"https://api.github.com/repos/blink1073/jupyter-js-services/commits{/sha}","git_commits_url":"https://api.github.com/repos/blink1073/jupyter-js-services/git/commits{/sha}","comments_url":"https://api.github.com/repos/blink1073/jupyter-js-services/comments{/number}","issue_comment_url":"https://api.github.com/repos/blink1073/jupyter-js-services/issues/comments{/number}","contents_url":"https://api.github.com/repos/blink1073/jupyter-js-services/contents/{+path}","compare_url":"https://api.github.com/repos/blink1073/jupyter-js-services/compare/{base}...{head}","merges_url":"https://api.github.com/repos/blink1073/jupyter-js-services/merges","archive_url":"https://api.github.com/repos/blink1073/jupyter-js-services/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/blink1073/jupyter-js-services/downloads","issues_url":"https://api.github.com/repos/blink1073/jupyter-js-services/issues{/number}","pulls_url":"https://api.github.com/repos/blink1073/jupyter-js-services/pulls{/number}","milestones_url":"https://api.github.com/repos/blink1073/jupyter-js-services/milestones{/number}","notifications_url":"https://api.github.com/repos/blink1073/jupyter-js-services/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/blink1073/jupyter-js-services/labels{/name}","releases_url":"https://api.github.com/repos/blink1073/jupyter-js-services/releases{/id}","created_at":"2015-08-07T15:11:05Z","updated_at":"2015-08-19T19:26:01Z","pushed_at":"2015-08-26T16:25:20Z","git_url":"git://github.com/blink1073/jupyter-js-services.git","ssh_url":"git@github.com:blink1073/jupyter-js-services.git","clone_url":"https://github.com/blink1073/jupyter-js-services.git","svn_url":"https://github.com/blink1073/jupyter-js-services","homepage":null,"size":587,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jupyter:master","ref":"master","sha":"2f5131f2d4b26159de8450fc57a867f28f0de483","user":{"login":"jupyter","id":7388996,"avatar_url":"https://avatars.githubusercontent.com/u/7388996?v=3","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"repo":{"id":39586505,"name":"jupyter-js-services","full_name":"jupyter/jupyter-js-services","owner":{"login":"jupyter","id":7388996,"avatar_url":"https://avatars.githubusercontent.com/u/7388996?v=3","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jupyter/jupyter-js-services","description":"Javascript client for the Jupyter services REST APIs","fork":false,"url":"https://api.github.com/repos/jupyter/jupyter-js-services","forks_url":"https://api.github.com/repos/jupyter/jupyter-js-services/forks","keys_url":"https://api.github.com/repos/jupyter/jupyter-js-services/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jupyter/jupyter-js-services/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jupyter/jupyter-js-services/teams","hooks_url":"https://api.github.com/repos/jupyter/jupyter-js-services/hooks","issue_events_url":"https://api.github.com/repos/jupyter/jupyter-js-services/issues/events{/number}","events_url":"https://api.github.com/repos/jupyter/jupyter-js-services/events","assignees_url":"https://api.github.com/repos/jupyter/jupyter-js-services/assignees{/user}","branches_url":"https://api.github.com/repos/jupyter/jupyter-js-services/branches{/branch}","tags_url":"https://api.github.com/repos/jupyter/jupyter-js-services/tags","blobs_url":"https://api.github.com/repos/jupyter/jupyter-js-services/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jupyter/jupyter-js-services/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jupyter/jupyter-js-services/git/refs{/sha}","trees_url":"https://api.github.com/repos/jupyter/jupyter-js-services/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jupyter/jupyter-js-services/statuses/{sha}","languages_url":"https://api.github.com/repos/jupyter/jupyter-js-services/languages","stargazers_url":"https://api.github.com/repos/jupyter/jupyter-js-services/stargazers","contributors_url":"https://api.github.com/repos/jupyter/jupyter-js-services/contributors","subscribers_url":"https://api.github.com/repos/jupyter/jupyter-js-services/subscribers","subscription_url":"https://api.github.com/repos/jupyter/jupyter-js-services/subscription","commits_url":"https://api.github.com/repos/jupyter/jupyter-js-services/commits{/sha}","git_commits_url":"https://api.github.com/repos/jupyter/jupyter-js-services/git/commits{/sha}","comments_url":"https://api.github.com/repos/jupyter/jupyter-js-services/comments{/number}","issue_comment_url":"https://api.github.com/repos/jupyter/jupyter-js-services/issues/comments{/number}","contents_url":"https://api.github.com/repos/jupyter/jupyter-js-services/contents/{+path}","compare_url":"https://api.github.com/repos/jupyter/jupyter-js-services/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jupyter/jupyter-js-services/merges","archive_url":"https://api.github.com/repos/jupyter/jupyter-js-services/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jupyter/jupyter-js-services/downloads","issues_url":"https://api.github.com/repos/jupyter/jupyter-js-services/issues{/number}","pulls_url":"https://api.github.com/repos/jupyter/jupyter-js-services/pulls{/number}","milestones_url":"https://api.github.com/repos/jupyter/jupyter-js-services/milestones{/number}","notifications_url":"https://api.github.com/repos/jupyter/jupyter-js-services/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jupyter/jupyter-js-services/labels{/name}","releases_url":"https://api.github.com/repos/jupyter/jupyter-js-services/releases{/id}","created_at":"2015-07-23T19:05:42Z","updated_at":"2015-08-19T19:00:56Z","pushed_at":"2015-08-26T16:25:21Z","git_url":"git://github.com/jupyter/jupyter-js-services.git","ssh_url":"git@github.com:jupyter/jupyter-js-services.git","clone_url":"https://github.com/jupyter/jupyter-js-services.git","svn_url":"https://github.com/jupyter/jupyter-js-services","homepage":"","size":1032,"stargazers_count":2,"watchers_count":2,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4,"mirror_url":null,"open_issues_count":5,"forks":4,"open_issues":5,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jupyter/jupyter-js-services/pulls/20"},"html":{"href":"https://github.com/jupyter/jupyter-js-services/pull/20"},"issue":{"href":"https://api.github.com/repos/jupyter/jupyter-js-services/issues/20"},"comments":{"href":"https://api.github.com/repos/jupyter/jupyter-js-services/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/jupyter/jupyter-js-services/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/jupyter/jupyter-js-services/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jupyter/jupyter-js-services/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/jupyter/jupyter-js-services/statuses/ab025fb95de5daf204a568bebc9d8ff3a1219eaa"}}}}