ZeroBundle install, Update example with file read/write

This commit is contained in:
HelloZeroNet 2015-04-20 23:52:32 +02:00
parent 0b43f11023
commit 8523a4aa36
4 changed files with 28 additions and 10 deletions

View File

@ -2,13 +2,21 @@
### Windows
* [Download ZeroBundle package](https://github.com/HelloZeroNet/ZeroBundle/releases/download/0.1.0/ZeroBundle-v0.1.0.zip) that includes Python 2.7.9 and all required library
* Unpack to any directory
* Run `zeronet.cmd`
It downloads the latest version of ZeroNet then starts it automatically.
#### Alternative method for Windows by installing Python
* [Install Python 2.7](https://www.python.org/ftp/python/2.7.9/python-2.7.9.msi)
* [Install Python ZeroMQ](http://zeronet.io/files/windows/pyzmq-14.4.1.win32-py2.7.exe)
* [Install Python Greenlet](http://zeronet.io/files/windows/greenlet-0.4.5.win32-py2.7.exe)
* [Install Python Gevent](http://zeronet.io/files/windows/gevent-1.0.1.win32-py2.7.exe)
* [Install Python MsgPack](http://zeronet.io/files/windows/msgpack-python-0.4.2.win32-py2.7.exe)
* [Download and extract ZeroNet](https://codeload.github.com/HelloZeroNet/ZeroNet/zip/master) to any directory
* Start `start.py`
* Run `start.py`
### Linux

View File

@ -2,7 +2,19 @@
<body>
<h1>ZeroFrame API example</h1>
Check your javascript console for log messages
<h2>Notification examples</h2>
<input type='button' onclick='my_site.cmd("wrapperNotification", ["done", "Hello World!", 10000])' value='With 10sec timeout'>
<input type='button' onclick='my_site.cmd("wrapperNotification", ["error", "Some error"])' value='Error with no timeout'>
<input type='button' onclick='my_site.cmd("wrapperConfirm", ["Are you sure?"], function (res) { output.value += res+"\n" })' value='Confirmation'>
<input type='button' onclick='my_site.cmd("wrapperPrompt", ["Whats your name?"], function (res) { output.value += res+"\n" })' value='Prompt'>
<h2>File write example</h2>
<input type='button' onclick='my_site.cmd("fileWrite", ["data.txt", btoa("hello from ZeroApi")], function (res) { output.value += "fileWrite result:"+res+"\n" })' value='Write file data.txt'>
<input type='button' onclick='my_site.cmd("fileGet", ["data.txt"], function (res) { output.value += "fileGet result:"+res+"\n" })' value='Read file data.txt'>
<h3>Output</h3>
<textarea id='output' style='width: 600px; height: 300px'></textarea>
<script type='text/javascript' src='js/all.js' asyc></script>
</body>

View File

@ -8,7 +8,6 @@ class MySite extends ZeroFrame
@log "mysite serverInfo response", serverInfo
@cmd "siteInfo", {}, (siteInfo) =>
@log "mysite siteInfo response", siteInfo
@cmd "wrapperNotification", ["done", "Hello World!", 10000]
window.my_site = new MySite()
window.my_site = new MySite()

View File

@ -1,6 +1,6 @@
/* ---- data/1PkBs1yrWupYbugp4NU7K6enMqF4JWwDqJ/js/lib/ZeroFrame.coffee ---- */
/* ---- data/1QWU6APGTFRynSmNA53qgCaVAxpVA9nYa/js/lib/ZeroFrame.coffee ---- */
(function() {
@ -114,14 +114,14 @@
}).call(this);
/* ---- data/1PkBs1yrWupYbugp4NU7K6enMqF4JWwDqJ/js/MySite.coffee ---- */
/* ---- data/1QWU6APGTFRynSmNA53qgCaVAxpVA9nYa/js/MySite.coffee ---- */
(function() {
var MySite,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__hasProp = {}.hasOwnProperty;
MySite = (function(_super) {
__extends(MySite, _super);
@ -141,12 +141,11 @@
return _this.log("mysite serverInfo response", serverInfo);
};
})(this));
this.cmd("siteInfo", {}, (function(_this) {
return this.cmd("siteInfo", {}, (function(_this) {
return function(siteInfo) {
return _this.log("mysite siteInfo response", siteInfo);
};
})(this));
return this.cmd("wrapperNotification", ["done", "Hello World!", 10000]);
};
return MySite;