1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: wrap up unsafe { nil } (p. 3)

This commit is contained in:
Alexander Medvednikov
2022-07-21 21:01:30 +03:00
parent a68d03ac59
commit 9099594a49
51 changed files with 86 additions and 86 deletions

View File

@ -343,7 +343,7 @@ pub const (
)
pub fn window() JS.Window {
mut x := JS.Any(voidptr(0))
mut x := JS.Any(unsafe { nil })
#x = window;
return x
@ -359,7 +359,7 @@ pub type EventCallback = fn (JS.Event)
// that is EventTarget. When you need access only to Event itself you can just use `fn (JS.Event)` as listener.
pub fn event_listener(callback fn (JS.EventTarget, JS.Event)) EventCallback {
return fn [callback] (event JS.Event) {
mut target := JS.EventTarget(voidptr(0))
mut target := JS.EventTarget(unsafe { nil })
#target = this;
callback(target, event)
}
@ -490,7 +490,7 @@ pub type OnDeviceOrientation = fn (ev JS.DeviceOrientationEvent) JS.Any
pub fn on_device_motion(cb fn (win JS.Window, ev JS.DeviceMotionEvent) JS.Any) OnDeviceMotion {
clos := fn [cb] (ev JS.DeviceMotionEvent) JS.Any {
mut win := JS.Any(voidptr(0))
mut win := JS.Any(unsafe { nil })
#win = this;
return cb(win, ev)
@ -500,7 +500,7 @@ pub fn on_device_motion(cb fn (win JS.Window, ev JS.DeviceMotionEvent) JS.Any) O
pub fn on_device_orientation(cb fn (win JS.Window, ev JS.DeviceOrientationEvent) JS.Any) OnDeviceOrientation {
clos := fn [cb] (ev JS.DeviceOrientationEvent) JS.Any {
mut win := JS.Any(voidptr(0))
mut win := JS.Any(unsafe { nil })
#win = this;
return cb(win, ev)
@ -837,7 +837,7 @@ pub fn event_type(ev JS.Event) string {
}
pub fn create_event(typ string, bubbles bool, cancelable bool, composed bool) JS.Event {
mut ev := JS.Event(voidptr(0))
mut ev := JS.Event(unsafe { nil })
#ev = new Event(typ.str,bubbles.val,cancelable.val,composed.val);
return ev

View File

@ -23,7 +23,7 @@ pub interface JS.Response {
}
pub fn fetch(input string, init map[string]JS.Any) promise.Promise<JS.Response, JS.String> {
p_init := JS.Any(voidptr(0))
p_init := JS.Any(unsafe { nil })
p := promise.Promise<JS.Response, String>{p_init}
#let obj = {}; for (let [key,val] of init.map) { obj[key] = val; }