mirror of
https://github.com/penpot/penpot.git
synced 2025-07-23 15:57:26 +02:00
🔥 Remove unused code.
This commit is contained in:
parent
0dbcfcbc0b
commit
60b241e867
9 changed files with 49 additions and 136 deletions
|
@ -1,31 +0,0 @@
|
|||
;; 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) 2016 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns app.util.blob
|
||||
"Helpers for work with HTML5 Blob objects.")
|
||||
|
||||
;; TODO: DEPRECATED
|
||||
|
||||
(defn ^boolean blob?
|
||||
[v]
|
||||
(instance? js/Blob v))
|
||||
|
||||
(defn create
|
||||
"Create a blob from content."
|
||||
([content]
|
||||
(create content "application/octet-stream"))
|
||||
([content mimetype]
|
||||
(js/Blob. #js [content] #js {:type mimetype})))
|
||||
|
||||
(defn revoke-uri
|
||||
[url]
|
||||
(js/URL.revokeObjectURL url))
|
||||
|
||||
(defn create-uri
|
||||
"Create a url from blob."
|
||||
[b]
|
||||
{:pre [(blob? b)]}
|
||||
(js/URL.createObjectURL b))
|
|
@ -14,7 +14,6 @@
|
|||
[beicon.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.util.blob :as blob]
|
||||
[app.util.transit :as ts]))
|
||||
|
||||
;; --- Deprecated methods
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
;; 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) 2016 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns app.util.files
|
||||
"A interop helpers for work with files."
|
||||
(:require [beicon.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[app.util.blob :as blob]))
|
||||
|
||||
;; TODO: DEPRECATED
|
||||
|
||||
(defn read-as-text
|
||||
[file]
|
||||
(rx/create
|
||||
(fn [sink]
|
||||
(let [fr (js/FileReader.)]
|
||||
(aset fr "onload" #(sink (rx/end (.-result fr))))
|
||||
(.readAsText fr file)
|
||||
(constantly nil)))))
|
||||
|
||||
(defn read-as-dataurl
|
||||
[file]
|
||||
(rx/create
|
||||
(fn [sick]
|
||||
(let [fr (js/FileReader.)]
|
||||
(aset fr "onload" #(sick (rx/end (.-result fr))))
|
||||
(.readAsDataURL fr file))
|
||||
(constantly nil))))
|
||||
|
||||
(defn get-image-size
|
||||
[file]
|
||||
(letfn [(on-load [sink img]
|
||||
(let [size [(.-width img) (.-height img)]]
|
||||
(sink (rx/end size))))
|
||||
(on-subscribe [sink]
|
||||
(let [img (js/Image.)
|
||||
uri (blob/create-uri file)]
|
||||
(set! (.-onload img) (partial on-load sink img))
|
||||
(set! (.-src img) uri)
|
||||
#(blob/revoke-uri uri)))]
|
||||
(rx/create on-subscribe)))
|
|
@ -1,25 +0,0 @@
|
|||
;; 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) 2016 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns app.util.interop
|
||||
"Interop helpers.")
|
||||
|
||||
;; TODO: this can be optimized using es6-iterator-seq
|
||||
(defn iterable->seq
|
||||
"Convert an es6 iterable into cljs Seq."
|
||||
[v]
|
||||
(seq (js/Array.from v)))
|
||||
|
||||
(defn obj-assign!
|
||||
([a b]
|
||||
(js/Object.assign a b))
|
||||
([a b & more]
|
||||
(reduce obj-assign! (obj-assign! a b) more)))
|
||||
|
||||
(defn obj-assoc!
|
||||
[obj attr value]
|
||||
(unchecked-set obj attr value)
|
||||
obj)
|
|
@ -10,9 +10,10 @@
|
|||
(ns app.util.websockets
|
||||
"A interface to webworkers exposed functionality."
|
||||
(:require
|
||||
[goog.events :as ev]
|
||||
[app.config :as cfg]
|
||||
[app.util.transit :as t]
|
||||
[beicon.core :as rx]
|
||||
[goog.events :as ev]
|
||||
[potok.core :as ptk])
|
||||
(:import
|
||||
goog.Uri
|
||||
|
@ -63,3 +64,11 @@
|
|||
(ev/unlistenByKey lk1)
|
||||
(ev/unlistenByKey lk2)
|
||||
(ev/unlistenByKey lk3)))))
|
||||
|
||||
(defn message?
|
||||
[msg]
|
||||
(= (:type msg) :message))
|
||||
|
||||
(defn send!
|
||||
[ws msg]
|
||||
(-send ws (t/encode msg)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue