Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Missing utility methods in StudioApp #53

Open
aqmnguyen opened this issue Aug 6, 2018 · 1 comment
Open

Missing utility methods in StudioApp #53

aqmnguyen opened this issue Aug 6, 2018 · 1 comment

Comments

@aqmnguyen
Copy link

Would be nice if the StudioApp contained all the methods in the studio-utility library we have, some useful methods SE use regularly that are missing:

attributesForTag
attributesByTagID
replaceToken
@mnutt
Copy link
Member

mnutt commented Aug 14, 2018

I think that most of what studio-utility offered is covered by studio-app, but if there are gaps I definitely want to fill them!

// studio-utility:
StudioUtility.attributesForTag(tagId)
// studio-app:
this.allTags().find(t => t.id === tagId)

// studio-utility:
StudioUtility.replaceToken(element, 'foo', 'bar')
// studio-app:
this.replaceTokens(this.allTags(), { foo: 'bar' })

The this.allTags() method is pretty versatile; you can do things like this.allTags().filter(t => t.toolName === 'hammer') to get all of your hammer layers. And if you want to get the elements themselves you can chain .map(t => t.element) to get an array of DOM elements.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants