Skip to content

Instantly share code, notes, and snippets.

@takimo
Forked from kanekoa/reminder_message.html
Last active December 17, 2015 21:30
Show Gist options
  • Save takimo/5675529 to your computer and use it in GitHub Desktop.
Save takimo/5675529 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Reminder Message</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
</head>
<body>
<div class="dialog example container">
<form>
<fieldset>
<label>message</label>
<input id="message" type="text" placeholder="Type something…" value="Confirm">
<label>delay seccond</label>
<select id="delay_seccond">
<option>3</option>
<option>5</option>
<option>10</option>
</select>
<div>
<button id="submit" type="button" class="btn">Submit</button>
</div>
</fieldset>
</form>
<div id="display" class="alert alert-info">
This is sample message.
</div>
</div>
<script src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script src="http://mixi.jp/static/js/lib/triaina/bridge.js"></script>
<script>
$("#submit").click(function(event){
var message = $("#message").val() || "default message.";
var delaySeccond = $("#delay_seccond").val() || 5;
WebBridge.call(
'com.example.reminder_message.put',
{
'message': message,
'delay_seccond': delaySeccond
},
function(result){
// receive result
$("#display").html(JSON.stringify(result));
}
);
});
WebBridge.observe('com.example.reminder_message.notify', function(data){
$("#display").html(data.params.message);
});
</script>
</body>
</html>
# リマインダーメッセージ
## com.example.reminder_message.put
### Request
{
"bridge": "1.1",
"dest": "com.example.reminder_message.put",
"params": {
"message": "10秒後の自分、こんにちわ!",
"delay_seccond" : 10
},
"id": 1
}
### Response
{
"bridge": "1.1",
"result": {
"status": "ok" // or "error"
},
"id": 1
}
## com.example.reminder_message.notify
### Request
{
"bridge": "1.1",
"dest": "com.example.reminder_message.notify",
"params": {
"message": "10秒後の自分、こんにちわ!",
},
"id": null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment