mirror of
https://github.com/amark/gun.git
synced 2025-06-05 21:56:51 +00:00
unbuild SEA
This commit is contained in:
parent
6de5ff282c
commit
f9c0d929a0
@ -75,17 +75,27 @@ var undent = function(code, n){
|
|||||||
|
|
||||||
;(function(){
|
;(function(){
|
||||||
|
|
||||||
rm('./src');
|
var arg = process.argv[2] || 'gun';
|
||||||
mk('./src');
|
|
||||||
mk('./src/polyfill');
|
|
||||||
mk('./src/adapters');
|
|
||||||
|
|
||||||
var gun = read('gun.js');
|
if('gun' === arg){
|
||||||
var code = next(gun);
|
rm('./src');
|
||||||
|
mk('./src');
|
||||||
|
mk('./src/polyfill');
|
||||||
|
mk('./src/adapters');
|
||||||
|
} else {
|
||||||
|
rm('./'+arg);
|
||||||
|
mk('./'+arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
var f = read(arg+'.js');
|
||||||
|
var code = next(f);
|
||||||
|
|
||||||
|
|
||||||
code = next("/* UNBUILD */");
|
code = next("/* UNBUILD */");
|
||||||
write('src/polyfill/unbuild.js', undent(code, 1));
|
|
||||||
|
if('gun' === arg){
|
||||||
|
write('src/polyfill/unbuild.js', undent(code, 1));
|
||||||
|
}
|
||||||
|
|
||||||
(function recurse(c){
|
(function recurse(c){
|
||||||
code = next(";USE(function(module){", "})(USE");
|
code = next(";USE(function(module){", "})(USE");
|
||||||
|
50
test/user.html
Normal file
50
test/user.html
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<h1>User</h1>
|
||||||
|
|
||||||
|
<form id="sign">
|
||||||
|
<input id="alias" placeholder="username">
|
||||||
|
<input id="pass" type="password" placeholder="passphrase">
|
||||||
|
<input id="in" type="submit" value="sign in">
|
||||||
|
<input id="up" type="button" value="sign up">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<ul></ul>
|
||||||
|
|
||||||
|
<form id="said">
|
||||||
|
<input id="say">
|
||||||
|
<input id="speak" type="button" value="speak">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script src="../examples/jquery.js"></script>
|
||||||
|
<script src="../gun.js"></script>
|
||||||
|
<script src="../sea.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var gun = Gun();
|
||||||
|
var user = gun.user();
|
||||||
|
|
||||||
|
$('#up').on('click', function(e){
|
||||||
|
user.create($('#alias').val(), $('#pass').val());
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#sign').on('submit', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
user.auth($('#alias').val(), $('#pass').val());
|
||||||
|
});
|
||||||
|
|
||||||
|
gun.on('auth', function(){
|
||||||
|
$('#sign').hide();
|
||||||
|
user.get('said').map().val(UI);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#said').on('submit', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
if(!user.is){ return }
|
||||||
|
user.get('said').set($('#say').val());
|
||||||
|
$('#say').val("");
|
||||||
|
});
|
||||||
|
|
||||||
|
function UI(say, id){
|
||||||
|
var li = $('#' + id).get(0) || $('<li>').attr('id', id).appendTo('ul');
|
||||||
|
$(li).text(say);
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
x
Reference in New Issue
Block a user