Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set_meta operation #117

Merged
merged 2 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions javascript/operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,21 @@ export default {
})
},

setMeta: operation => {
dispatch(document, 'cable-ready:before-set-meta', operation)
const { name, content } = operation
if (!operation.cancel) {
let meta = document.head.querySelector(`meta[name='${name}']`)
if (!meta) {
meta = document.createElement('meta')
meta.name = name
document.head.appendChild(meta)
}
meta.content = content
}
dispatch(document, 'cable-ready:after-set-meta', operation)
},

// Browser Manipulations

clearStorage: operation => {
Expand Down
1 change: 1 addition & 0 deletions lib/cable_ready/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def default_operation_names
set_cookie
set_dataset_property
set_focus
set_meta
set_property
set_storage_item
set_style
Expand Down