adding view and show
This commit is contained in:
parent
89dc2f3023
commit
8ff9dd51d7
|
@ -1,10 +1,11 @@
|
|||
#lang planet dyoo/whalesong
|
||||
(require (planet dyoo/whalesong/web-world))
|
||||
(require (planet dyoo/whalesong/web-world)
|
||||
(planet dyoo/whalesong/resource))
|
||||
(define-resource index.html)
|
||||
|
||||
;; make-item: string -> view
|
||||
(define (make-item name)
|
||||
(view-bind (sexp->view `(li ,name))
|
||||
(view-bind (->view `(li ,name))
|
||||
"click"
|
||||
hide-on-click))
|
||||
|
||||
|
|
|
@ -36,6 +36,9 @@
|
|||
update-view-text
|
||||
|
||||
view-bind
|
||||
|
||||
view-show
|
||||
view-hide
|
||||
|
||||
view-attr
|
||||
update-view-attr
|
||||
|
|
|
@ -297,6 +297,31 @@
|
|||
});
|
||||
};
|
||||
|
||||
MockView.prototype.show = function() {
|
||||
return this.act(
|
||||
function(cursor) {
|
||||
return cursor.replaceNode($(cursor.node).clone(true).show().get(0));
|
||||
},
|
||||
function(eventHandlers) { return eventHandlers; },
|
||||
function(view) {
|
||||
view.focus.show();
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
MockView.prototype.hide = function() {
|
||||
return this.act(
|
||||
function(cursor) {
|
||||
return cursor.replaceNode($(cursor.node).clone(true).hide().get(0));
|
||||
},
|
||||
function(eventHandlers) { return eventHandlers; },
|
||||
function(view) {
|
||||
view.focus.hide();
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -1123,6 +1148,26 @@
|
|||
return view.updateFormValue(value);
|
||||
});
|
||||
|
||||
EXPORTS['view-show'] = makePrimitiveProcedure(
|
||||
'view-show',
|
||||
1,
|
||||
function(MACHINE) {
|
||||
var view = checkMockView(MACHINE, 'show', 0);
|
||||
return view.show(value);
|
||||
});
|
||||
|
||||
|
||||
EXPORTS['hide'] = makePrimitiveProcedure(
|
||||
'hide',
|
||||
1,
|
||||
function(MACHINE) {
|
||||
var view = checkMockView(MACHINE, 'hide', 0);
|
||||
return view.hide(value);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
update-view-form-value
|
||||
)
|
||||
|
||||
|
||||
(define (big-bang world . handlers)
|
||||
(error 'big-bang "Please run in JavaScript context."))
|
||||
|
||||
|
@ -75,3 +76,10 @@
|
|||
|
||||
(define (update-view-form-value val)
|
||||
(error 'view-form-value "Please run in JavaScript context."))
|
||||
|
||||
|
||||
(define (view-show)
|
||||
(error 'view-show "Please run in JavaScript context."))
|
||||
|
||||
(define (view-hide)
|
||||
(error 'view-hide "Please run in JavaScript context."))
|
||||
|
|
Loading…
Reference in New Issue
Block a user