mirror of
https://github.com/status-im/nimqml.git
synced 2025-02-23 03:48:19 +00:00
Passing custom events over single instance IPC
This commit is contained in:
parent
f2f8f3a9e9
commit
42b3b1af5b
@ -338,7 +338,7 @@ proc dos_qurl_host(host: cstring): cstring {.cdecl, dynlib: dynLibName, importc.
|
||||
proc dos_qurl_replaceHostAndAddPath(url: cstring, newScheme: cstring, newHost: cstring, pathPrefix: cstring): cstring {.cdecl, dynlib: dynLibName, importc.}
|
||||
|
||||
# SingleInstance
|
||||
proc dos_singleinstance_create(uniqueName: cstring): DosQObject {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_singleinstance_create(uniqueName: cstring, eventStr: cstring): DosQObject {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_singleinstance_isfirst(vptr: DosQObject): bool {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_singleinstance_delete(vptr: DosQObject) {.cdecl, dynlib: dynLibName, importc.}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
proc setup*(self: SingleInstance, uniqueName: string) =
|
||||
proc setup*(self: SingleInstance, uniqueName: string, eventStr: string) =
|
||||
## Setup a new SingleInstance
|
||||
self.vptr = dos_singleinstance_create(uniqueName)
|
||||
self.vptr = dos_singleinstance_create(uniqueName, eventStr)
|
||||
|
||||
proc delete*(self: SingleInstance) =
|
||||
## Delete the given SingleInstance
|
||||
@ -9,9 +9,9 @@ proc delete*(self: SingleInstance) =
|
||||
dos_singleinstance_delete(self.vptr)
|
||||
self.vptr.resetToNil
|
||||
|
||||
proc newSingleInstance*(uniqueName: string): SingleInstance =
|
||||
proc newSingleInstance*(uniqueName: string, eventStr: string): SingleInstance =
|
||||
new(result, delete)
|
||||
result.setup(uniqueName)
|
||||
result.setup(uniqueName, eventStr)
|
||||
|
||||
proc secondInstance*(self: SingleInstance): bool =
|
||||
return not dos_singleinstance_isfirst(self.vptr)
|
||||
|
Loading…
x
Reference in New Issue
Block a user