Skip to content

Instantly share code, notes, and snippets.

@philcleveland
Last active August 29, 2015 14:10
Show Gist options
  • Save philcleveland/11a69f8d4b03c4891445 to your computer and use it in GitHub Desktop.
Save philcleveland/11a69f8d4b03c4891445 to your computer and use it in GitHub Desktop.
<script>
function getStudyMetadata() {
var promise = $.ajax({
type: "GET",
url: "/study/metadata/{id}",
dataType: "json"
}).promise();
return Rx.Observable.fromPromise(promise);
};
$(function () {
getStudyMetadata()
.subscribe(
function (result) {
mainViewVM = new MainViewViewModel(result);
@*fire off knockout*@
ko.applyBindings(mainViewVM);
initCanvas(mainViewVM.imageWidth, mainViewVM.imageHeight);
initRowCanvas(mainViewVM);
},
function (err) {
alert("ERROR:" + err);
console.log("ERROR:" + err.error);
},
function () {
console.log("COMPLETED VM init");
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment