mirror of
https://github.com/penpot/penpot.git
synced 2025-07-14 20:07:17 +02:00
✨ Refactor to the context api
This commit is contained in:
parent
7b508f2803
commit
0ffd82299f
7 changed files with 187 additions and 82 deletions
|
@ -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}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue