Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Modified example to use urth-core-function
Browse files Browse the repository at this point in the history
(c) Copyright IBM Corp. 2015
  • Loading branch information
Gino Bustelo committed Dec 18, 2015
1 parent 84ef0ab commit df1acd7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions elements/urth-core-behaviors/execution-complete-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
console.debug("Registering _onExecutionComplete for Execute Reply messages.");
this.__replyCallback = this._onExecutionComplete.bind(this);

IPython.notebook.kernel.widget_manager.notebook.events.on(
IPython.notebook.events.on(
'shell_reply.Kernel', this.__replyCallback
);
},

detached: function() {
console.debug("Unregistering _onExecutionComplete for Execute Reply messages.");
if (this.__replyCallback){
IPython.notebook.kernel.widget_manager.notebook.events.off(
IPython.notebook.events.off(
'shell_reply.Kernel', this.__replyCallback
);
}
Expand Down
4 changes: 4 additions & 0 deletions etc/examples/standalone/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
<div class="inputarea"></div>
<div class="widgetarea"></div>
<template is='urth-core-bind' channel='a'>
<template is='dom-if' if='{{isready}}'>
<urth-core-function ref="hello" arg-name="{{name}}" result="{{msg}}" auto></urth-core-function>
name: <input type="text" value="{{name::input}}"></input>
</template>
<H1>{{msg}}</H1>
</template>
</div>
Expand Down
6 changes: 5 additions & 1 deletion etc/examples/standalone/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ document.addEventListener("DOMContentLoaded", function(event) {

// Run backend code to create the widgets. You could also create the
// widgets in the frontend, like the other /web/ examples demonstrate.
kernel.execute({ code: code });
var execPromise = kernel.execute({ code: code });
execPromise.onReply = function(){
IPython.notebook.events.trigger('shell_reply.Kernel');
}

});
});
6 changes: 5 additions & 1 deletion etc/examples/standalone/widget_code.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[
"from urth.widgets.widget_channels import channel",
"channel('a').set('msg', 'Hello from kernel')"
"def hello(name):",
" return 'Hello ' + name",
"channel('a').set('isready', True)"
]


0 comments on commit df1acd7

Please sign in to comment.