penpot/frontend/src/app/plugins/utils.cljs
2024-04-19 01:29:13 +02:00

30 lines
646 B
Clojure

;; 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.plugins.utils
"RPC for plugins runtime."
(:require
[app.util.object :as obj]))
(defn get-data
([self attr]
(-> (obj/get self "_data")
(get attr)))
([self attr transform-fn]
(-> (get-data self attr)
(transform-fn))))
(defn get-data-fn
([attr]
(fn [self]
(get-data self attr)))
([attr transform-fn]
(fn [self]
(get-data self attr transform-fn))))