Refactor to the context api

This commit is contained in:
alonso.torres 2024-04-18 16:42:09 +02:00 committed by Andrey Antukh
parent 7b508f2803
commit 0ffd82299f
7 changed files with 187 additions and 82 deletions

View file

@ -5,8 +5,26 @@
;; Copyright (c) KALEIDOS INC
(ns app.plugins.utils
"RPC for plugins runtime.")
"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))))
(defn hide-data!
[proxy]
(.defineProperty js/Object proxy "_data" #js {:enumerable false}))