{"action":"created","comment":{"url":"https://api.github.com/repos/jupyter/phosphor-notebook/pulls/comments/33592832","id":33592832,"diff_hunk":"@@ -0,0 +1,275 @@\n+// Copyright (c) Jupyter Development Team.\n+// Distributed under the terms of the Modified BSD License.\n+\n+import moment = require('moment');\n+\n+\n+export\n+class WrappedError implements Error {\n+\n+  message: string;\n+  name: string;\n+  errorStack: Error[];\n+\n+  /**\n+   * Wrappable Error class\n+   *\n+   * The Error class doesn't actually act on `this`.  Instead it always\n+   * returns a new instance of Error.  Here we capture that instance so we\n+   * can apply it's properties to `this`.\n+   */\n+  constructor(message: string, error: Error) {\n+\n+    var tmp = Error.apply(this, [message]);\n+\n+    // Copy the properties of the error over to this.\n+    this.message = error.message;\n+    this.name = error.name;\n+\n+    // Keep a stack of the original error messages.\n+    if (error instanceof WrappedError) {\n+      this.errorStack = error.errorStack;\n+    } else {\n+      this.errorStack = [error];\n+    }\n+    this.errorStack.push(tmp);\n+\n+  }\n+}\n+\n+\n+/*\n+  Copy the contents of one object to another, recursively\n+\n+  http://stackoverflow.com/questions/12317003/something-like-jquery-extend-but-standalone\n+*/\n+export\n+var extend = function(target: any, source: any): any {\n+  target = target || {};\n+  for (var prop in source) {\n+    if (typeof source[prop] === 'object') {\n+      target[prop] = extend(target[prop], source[prop]);\n+    } else {\n+      target[prop] = source[prop];\n+    }\n+  }\n+  return target;\n+};\n+\n+\n+export\n+var uuid = function(): string {\n+  /**\n+   * http://www.ietf.org/rfc/rfc4122.txt\n+   */\n+  var s: string[] = [];\n+  var hexDigits = \"0123456789ABCDEF\";\n+  for (var i = 0; i < 32; i++) {\n+    s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);\n+  }\n+  s[12] = \"4\";  // bits 12-15 of the time_hi_and_version field to 0010\n+  s[16] = hexDigits.substr((Number(s[16]) & 0x3) | 0x8, 1);  // bits 6-7 of the clock_seq_hi_and_reserved to 01\n+\n+  var uuid = s.join(\"\");\n+  return uuid;\n+};\n+\n+\n+/**\n+ * join a sequence of url components with '/'\n+ */\n+export\n+var urlPathJoin = function(...paths: string[]): string {\n+\n+  var url = '';\n+  for (var i = 0; i < paths.length; i++) {\n+    if (paths[i] === '') {\n+      continue;\n+    }\n+    if (url.length > 0 && url[url.length - 1] != '/') {\n+      url = url + '/' + paths[i];\n+    } else {\n+      url = url + paths[i];\n+    }\n+  }\n+  url = url.replace(/\\/\\/+/, '/');\n+  return url;\n+};\n+\n+\n+/**\n+ * encode just the components of a multi-segment uri,\n+ * leaving '/' separators\n+ */\n+export\n+var encodeURIComponents = function(uri: string): string {\n+  return uri.split('/').map(encodeURIComponent).join('/');\n+};\n+\n+\n+/**\n+ * join a sequence of url components with '/',\n+ * encoding each component with encodeURIComponent\n+ */\n+export\n+var urlJoinEncode = function(...args: string[]): string {\n+  return encodeURIComponents(urlPathJoin.apply(null, args));\n+};\n+\n+\n+// http://stackoverflow.com/questions/2400935/browser-detection-in-javascript\n+export\n+var browser: string[] = (function() {\n+  if (typeof navigator === 'undefined') {\n+    // navigator undefined in node\n+    return ['None'];\n+  }\n+  var N: string = navigator.appName;\n+  var ua: string = navigator.userAgent\n+  var tem: RegExpMatchArray;\n+  var M: RegExpMatchArray = ua.match(/(opera|chrome|safari|firefox|msie)\\/?\\s*(\\.?\\d+(\\.\\d+)*)/i);\n+  if (M && (tem = ua.match(/version\\/([\\.\\d]+)/i)) !== null) M[2] = tem[1];\n+  M = M ? [M[1], M[2]] : [N, navigator.appVersion, '-?'];\n+  return M;\n+})();\n+\n+\n+/** \n+ * Return a serialized object string suitable for a query\n+\n+  http://stackoverflow.com/a/30707423\n+ */\n+export\n+var jsonToQueryString = function(json: any) {\n+  return '?' +\n+    Object.keys(json).map(function(key: string): any {\n+      return encodeURIComponent(key) + '=' +\n+        encodeURIComponent(json[key]);\n+    }).join('&');\n+}\n+\n+\n+export\n+interface IAjaxSuccess {\n+  data: any;\n+  status: string;\n+  xhr: XMLHttpRequest;\n+};\n+\n+\n+export\n+interface IAjaxError {\n+  xhr: XMLHttpRequest;\n+  status: string;\n+  err: string;\n+};\n+\n+\n+export\n+interface IAjaxSetttings {\n+  method: string;\n+  dataType: string;\n+  contentType?: string;\n+  data?: any;\n+};\n+\n+/*\n+ * Asynchronous XMLHTTPRequest handler\n+ *\n+ * http://www.html5rocks.com/en/tutorials/es6/promises/#toc-promisifying-xmlhttprequest\n+ */\n+export\n+var ajaxProxy = function(url: string, settings: IAjaxSetttings): Promise<any> {\n+\n+  return new Promise(function(resolve, reject) {\n+    var req = new XMLHttpRequest();\n+    req.open(settings.method, url);\n+    if (settings.contentType) {\n+      req.overrideMimeType(settings.contentType);\n+    }\n+\n+    req.onload = function() {","path":"src/utils.ts","position":186,"original_position":191,"commit_id":"5b7292862f469733e46143dc30b4021f97b6d318","original_commit_id":"b8f8ea20ae70ac4e4878a2860a03121f7f1e05d8","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":"this can be an arrow function","created_at":"2015-06-30T16:26:48Z","updated_at":"2015-06-30T16:26:48Z","html_url":"https://github.com/jupyter/phosphor-notebook/pull/1#discussion_r33592832","pull_request_url":"https://api.github.com/repos/jupyter/phosphor-notebook/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/jupyter/phosphor-notebook/pulls/comments/33592832"},"html":{"href":"https://github.com/jupyter/phosphor-notebook/pull/1#discussion_r33592832"},"pull_request":{"href":"https://api.github.com/repos/jupyter/phosphor-notebook/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/jupyter/phosphor-notebook/pulls/1","id":38883606,"html_url":"https://github.com/jupyter/phosphor-notebook/pull/1","diff_url":"https://github.com/jupyter/phosphor-notebook/pull/1.diff","patch_url":"https://github.com/jupyter/phosphor-notebook/pull/1.patch","issue_url":"https://api.github.com/repos/jupyter/phosphor-notebook/issues/1","number":1,"state":"open","locked":false,"title":"Upgrade Kernel.ts","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":"- Removed use of callbacks in favor of `KernelFuture`\r\n- Removed use of `events` in favor of phosphor `Signal`\r\n- Added minimal `utils.ts` and `serialize.ts` in support of `kernel.ts`\r\n- Removed all traces of JQuery\r\n- Added private methods as appropriate\r\n- Added to `tsd.json` as required\r\n- General cleanup and style fixes\r\n- Ensured clean build of `gulp`\r\n\r\nNotes: \r\n- I intentionally removed the `comm_manager` from `kernel.ts`, to be handled in a future PR.\r\n- I will add `session.ts` in a separate PR, since that is needed to actually run the kernel.\r\n- I'd recommend reviewing `kernel.ts` as a [standalone file](https://github.com/blink1073/phosphor-notebook-1/blob/upgrade-kernel-ts/src/kernel.ts), the diff won't be very helpful.  \r\n\r\nFor discussion:\r\n- What to do about `Kernel.sendInputReply`?  Previously, it was triggered by an `event` from `outputarea.js`. `OutputArea` has no reference to any kernel objects.\r\n","created_at":"2015-06-30T14:27:14Z","updated_at":"2015-06-30T16:26:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d6de7cb50b3586a54aa6b54d30fcd6036768de7c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jupyter/phosphor-notebook/pulls/1/commits","review_comments_url":"https://api.github.com/repos/jupyter/phosphor-notebook/pulls/1/comments","review_comment_url":"https://api.github.com/repos/jupyter/phosphor-notebook/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jupyter/phosphor-notebook/issues/1/comments","statuses_url":"https://api.github.com/repos/jupyter/phosphor-notebook/statuses/5b7292862f469733e46143dc30b4021f97b6d318","head":{"label":"blink1073:upgrade-kernel-ts","ref":"upgrade-kernel-ts","sha":"5b7292862f469733e46143dc30b4021f97b6d318","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":38313630,"name":"phosphor-notebook-1","full_name":"blink1073/phosphor-notebook-1","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/phosphor-notebook-1","description":"","fork":true,"url":"https://api.github.com/repos/blink1073/phosphor-notebook-1","forks_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/forks","keys_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/teams","hooks_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/hooks","issue_events_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/issues/events{/number}","events_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/events","assignees_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/assignees{/user}","branches_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/branches{/branch}","tags_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/tags","blobs_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/statuses/{sha}","languages_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/languages","stargazers_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/stargazers","contributors_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/contributors","subscribers_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/subscribers","subscription_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/subscription","commits_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/contents/{+path}","compare_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/merges","archive_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/downloads","issues_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/issues{/number}","pulls_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/pulls{/number}","milestones_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/milestones{/number}","notifications_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/labels{/name}","releases_url":"https://api.github.com/repos/blink1073/phosphor-notebook-1/releases{/id}","created_at":"2015-06-30T14:23:36Z","updated_at":"2015-06-30T14:23:36Z","pushed_at":"2015-06-30T16:21:02Z","git_url":"git://github.com/blink1073/phosphor-notebook-1.git","ssh_url":"git@github.com:blink1073/phosphor-notebook-1.git","clone_url":"https://github.com/blink1073/phosphor-notebook-1.git","svn_url":"https://github.com/blink1073/phosphor-notebook-1","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jupyter:master","ref":"master","sha":"6bb145a58b5d9a1ea17c6d3def7065079fab2909","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":38249514,"name":"phosphor-notebook","full_name":"jupyter/phosphor-notebook","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/phosphor-notebook","description":"","fork":false,"url":"https://api.github.com/repos/jupyter/phosphor-notebook","forks_url":"https://api.github.com/repos/jupyter/phosphor-notebook/forks","keys_url":"https://api.github.com/repos/jupyter/phosphor-notebook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jupyter/phosphor-notebook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jupyter/phosphor-notebook/teams","hooks_url":"https://api.github.com/repos/jupyter/phosphor-notebook/hooks","issue_events_url":"https://api.github.com/repos/jupyter/phosphor-notebook/issues/events{/number}","events_url":"https://api.github.com/repos/jupyter/phosphor-notebook/events","assignees_url":"https://api.github.com/repos/jupyter/phosphor-notebook/assignees{/user}","branches_url":"https://api.github.com/repos/jupyter/phosphor-notebook/branches{/branch}","tags_url":"https://api.github.com/repos/jupyter/phosphor-notebook/tags","blobs_url":"https://api.github.com/repos/jupyter/phosphor-notebook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jupyter/phosphor-notebook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jupyter/phosphor-notebook/git/refs{/sha}","trees_url":"https://api.github.com/repos/jupyter/phosphor-notebook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jupyter/phosphor-notebook/statuses/{sha}","languages_url":"https://api.github.com/repos/jupyter/phosphor-notebook/languages","stargazers_url":"https://api.github.com/repos/jupyter/phosphor-notebook/stargazers","contributors_url":"https://api.github.com/repos/jupyter/phosphor-notebook/contributors","subscribers_url":"https://api.github.com/repos/jupyter/phosphor-notebook/subscribers","subscription_url":"https://api.github.com/repos/jupyter/phosphor-notebook/subscription","commits_url":"https://api.github.com/repos/jupyter/phosphor-notebook/commits{/sha}","git_commits_url":"https://api.github.com/repos/jupyter/phosphor-notebook/git/commits{/sha}","comments_url":"https://api.github.com/repos/jupyter/phosphor-notebook/comments{/number}","issue_comment_url":"https://api.github.com/repos/jupyter/phosphor-notebook/issues/comments{/number}","contents_url":"https://api.github.com/repos/jupyter/phosphor-notebook/contents/{+path}","compare_url":"https://api.github.com/repos/jupyter/phosphor-notebook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jupyter/phosphor-notebook/merges","archive_url":"https://api.github.com/repos/jupyter/phosphor-notebook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jupyter/phosphor-notebook/downloads","issues_url":"https://api.github.com/repos/jupyter/phosphor-notebook/issues{/number}","pulls_url":"https://api.github.com/repos/jupyter/phosphor-notebook/pulls{/number}","milestones_url":"https://api.github.com/repos/jupyter/phosphor-notebook/milestones{/number}","notifications_url":"https://api.github.com/repos/jupyter/phosphor-notebook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jupyter/phosphor-notebook/labels{/name}","releases_url":"https://api.github.com/repos/jupyter/phosphor-notebook/releases{/id}","created_at":"2015-06-29T13:37:35Z","updated_at":"2015-06-30T15:23:43Z","pushed_at":"2015-06-30T16:21:03Z","git_url":"git://github.com/jupyter/phosphor-notebook.git","ssh_url":"git@github.com:jupyter/phosphor-notebook.git","clone_url":"https://github.com/jupyter/phosphor-notebook.git","svn_url":"https://github.com/jupyter/phosphor-notebook","homepage":null,"size":0,"stargazers_count":1,"watchers_count":1,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jupyter/phosphor-notebook/pulls/1"},"html":{"href":"https://github.com/jupyter/phosphor-notebook/pull/1"},"issue":{"href":"https://api.github.com/repos/jupyter/phosphor-notebook/issues/1"},"comments":{"href":"https://api.github.com/repos/jupyter/phosphor-notebook/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/jupyter/phosphor-notebook/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/jupyter/phosphor-notebook/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jupyter/phosphor-notebook/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/jupyter/phosphor-notebook/statuses/5b7292862f469733e46143dc30b4021f97b6d318"}}}}