mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
✨ Improve wasm api call method usability
This commit is contained in:
parent
db2eb2c420
commit
884414d5cf
2 changed files with 87 additions and 67 deletions
16
frontend/src/app/render_wasm/helpers.cljc
Normal file
16
frontend/src/app/render_wasm/helpers.cljc
Normal file
|
@ -0,0 +1,16 @@
|
|||
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; Copyright (c) KALEIDOS INC
|
||||
|
||||
(ns app.render-wasm.helpers
|
||||
#?(:cljs (:require-macros [app.render-wasm.helpers])))
|
||||
|
||||
(defmacro call
|
||||
"A helper for easy call wasm defined function in a module."
|
||||
[module name & params]
|
||||
(let [fn-sym (with-meta (gensym "fn-") {:tag 'function})]
|
||||
`(let [~fn-sym (cljs.core/unchecked-get ~module ~name)]
|
||||
(~fn-sym ~@params))))
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue