Lane Factor in Reservation Dogs, Iman Vellani in Ms. Marvel, and Morfydd Clark in The Lord of the Rings: The Rings of Power.Photo-Illustration: Rowena Lloyd and Susanna Hayward; Photos Courtesy of FX, Disney+ and Prime Video
There are many ways for an actor to leave their mark on a TV show: as a crucial component of a top-notch ensemble or chemistry-sparking duo, a contradictory hero or charismatic villain, a scene-stealing side character or versatile protagonist. All of these types of performances are represented on our television critics’ list of their 2022 favorites, and for each named here, there may be a dozen more who had a similarly profound effect on the shows in which they appeared. But the following performances, both solo and paired, were chosen for their sense of definitiveness, the feeling that they individually and collectively embody what made this year’s TV offerings interesting and special. A handful of these performances — presented here unranked and in order of 2022 premiere date — make an appearance on our top-ten lists, but most of them represent the best aspects of great but flawed series that didn’t quite make the cut, and all are worthy of attention and celebration as the year’s best.
Not a single damn thing about the almost painfully sweet queer YA romance Heartstopper would work without its central pair of performances. The show is lovely — the writing solid, the direction fuzzy and tender, members of the supporting cast all doing their part to round out the world of this British high-school series. But the difference between a just-fine Heartstopper and the dizzy, glowing Heartstopper that actually exists comes down to the work of Kit Connor and Joe Locke. They avoid simple reductions — Locke’s Charlie is sometimes shy and sometimes bold, while Connor’s Nick can be both confident and anxious — and they’re exquisitely, beautifully awkward and warm with each other and controlled without feeling mannered. Rom-coms have the bad reputation of being a plug-and-play genre, and nothing could be further from the truth. Without solid lead chemistry, the whole thing falls flat, and Connor and Locke absolutely nail it. —Kathryn VanArendonk
Jon Krakauer’s nonfiction book Under the Banner of Heaven: A Story of Violent Faith was already a horror story, and miniseries creator Dustin Lance Black didn’t lose any of that vibe in adapting the text into a true-crime format. Most beneficial to maintaining that sense of unsettling religious fervor was Wyatt Russell, who went full villain as fundamentalist Dan Lafferty. The scene where Dan self-righteously tells his wife that he’s listening to God by taking her daughters (his stepdaughters) as his next wives is made all the more awful by the calm commitment and moral certainty Russell brings to the character. It’s a purposefully enraging performance that Russell executes perfectly and a horrifying portrait of white-male villainy in a year defined, over and over, by white-male villainy. —Roxana Hadadi
In spite of its all-star cast and the Peterson case’s more-than-established bonafides as a central true-crime text of the last two decades, many pieces of HBO Max’s The Staircase never quite worked. Colin Firth’s Michael Peterson, petulant and bizarre, nevertheless fell short of the well-known source material, and the show itself struggled to encompass the long stretches of strangeness that have come to characterize this sprawling, messy story. But no iteration of The Staircase until now has come anywhere close to really depicting Kathleen Peterson — and certainly not with as much interesting, uneasy tension as Toni Collette’s performance brought. It is the brilliant, uncomfortable highlight of this show: She is the victim of something horrible, and at the same time, all of her stubborn human weaknesses mean that Collette can resist the urge to turn Peterson into either an angel or a harridan. More than anything else, she’s what makes The Staircase a striking addition to the mountain of Peterson-murder retellings. —K.V.A.
The magic of Anson Mount, Space Daddy Captain Extraordinaire, is in his remarkable flexibility. In Star Trek: Strange New Worlds, Mount’s role as Captain Pike could have easily been restricted to a narrow tonal bandwidth — and the show itself could’ve played with fewer emotional colors. But as an old-school episodic series, SNW toggles from silly to poignant to suspenseful and back again, and in any series attempting to contain that much breadth, the performances need to be roomy and nimble enough to work in all sorts of contexts. Mount’s Pike can do it all. He is tragic, swashbuckling, paternal, and quippy, and in the moments when he needs to, he can anchor an absolutely straight-faced thriller plotline. SNW and the rest of the show’s castcan pivot around him, exploring new life and civilizations without losing themselves. —K.V.A.
The P-Valley ensemble grew larger as its sophomore season became more ambitious in taking on COVID, gang vendettas, political backstabbing, and racist police brutality. Numerous cast members dug into weighty arcs — like J. Alphonse Nicholson’s Lil Murda and Shannon Thornton’s Keyshawn struggling to balance growing fame with their very different romantic relationships (the former fulfilling, the latter abusive) back home in Chucalissa. But of all those fantastic performers, Brandee Evans stood apart (in sky-high platforms, no less) as a narrative grounding force and dynamo of physicality, vulnerability, and compassion. Mercedes’s characterization expanded in exciting ways this season — from her unexpected affair with a long-term client’s wife to her attempt to be a better mother to her teen daughter and wondering who she’ll be if she leaves dancing behind. P-Valley asked a lot of Evans with these subplots, but every time, she rose to the occasion with an amalgam of sensuality, authority, fierceness, and dignity. Her work in “Jackson,” the season-two episode in which Mercedes learns that her daughter is pregnant and encourages her to consider an abortion and prioritize her right to choose, is standout stuff. —R.H.
The Marvel Cinematic Universe’s death grip on pop culture finally seemed to cool a bit in 2022 with mixed responses to films Doctor Strange in the Multiverse of Madness and Thor: Love and Thunder and TV series Moon Knight and She-Hulk: Attorney at Law. But it was difficult to deny the appeal of Iman Vellani, who in Disney+’s Ms. Marvel series delivered the strongest, most charismatic character introduction the franchise has seen in a while. As the titular Ms. Marvel and her under-the-mask identity, Kamala Khan, Vellani turned in a pair of naturalistic, sparkling performances in which her charisma melded with her own real-life enthusiasm for the character (and encyclopedic knowledge of the MCU — just watch one of her talk-show appearances). The series asked Vellani’s two characters to navigate multiple intertwined identities — Muslim, Pakistani American, first-generation daughter, and mutant, superhero, people’s champion — and she handled them all with nuance and ease. Vellani’s fearlessness, sincerity, and that infectious grin went a long way in recapturing what made the MCU so exciting in the first place. —R.H.
Everyone on Evil is an absolute delight. Each Michael Emerson line reading is a carnival ride, the four Bouchard daughters are adorable chaos agents, and nobody beats the shit out of demons using a shovel quite the way Andrea Martin does. But Katja Herbers, as skeptic forensic psychologist Kristen Bouchard, has been asked to play the widest spectrum of emotions and roles, and she has fully risen to that challenge. As a mother to four girls, she is both the measured, thoughtful person she is at work and an unpredictable mama bear who will rip to shreds anyone messing with her babies. During the past two seasons, Herbers has been a panicked wife dealing with her (allegedly) missing husband, a seductress with a forked tongue in David’s visions, and, at times, a gifted physical comedian. It’s a performance that demands vastness, but Herbers keeps it grounded in reality, and that’s crucial. We love Evil, because it’s absolutely bonkers television. We care about Evil, because its characters are real and recognizable. Herbers is both — and sometimes a demon too. —Jen Chaney
What stands out most about Lane Factor’s Cheese — the intelligent, emotionally articulate Rez Dog who meets every challenge in life with positivity — is his lack of artifice. His eyes (really, his entire face) are wide open in every scene, a fresh sponge primed to absorb whatever he encounters. Factor infuses Cheese with warmth and acceptance — he explains that his pronouns are he/him/his over and over with the same deep sincerity each time — yet he carries himself with the quiet confidence of a sage. He is called on more than once in the excellent second season of Reservation Dogs to lead a prayer, and Factor does it so naturally that it makes it seem like spiritual leadership could be Cheese’s calling. In the last prayer he says — for his late, greatly missed friend Daniel — every hitch in his voice breaks another little piece of your heart. —J.C.
Some performances stand out as striking interpretations of a character or unbelievably natural, subtle embodiments. There’s plenty that’s striking and subtle about Gbemisola Ikumelo’s role as Clance in A League of Their Own, but more than anything else, it’s that when she’s onscreen, she illuminates it. All of it. There are tons of strong performances in this series, yet no one else seems to be having quite this much fun or is as self-assured, engaged, or sparkling. Every scene that she’s in is better than the scenes without her. She should be cast in everything immediately. —K.V.A.
There was potentially too much fantasy IP this year, and The Rings of Power had the difficult task of both following Peter Jackson’s beloved films and challenging viewer expectations of the characters established in that cinematic trilogy. But Morfydd Clark’s Galadriel never seemed like she was straining to meet Cate Blanchett’s performance. As the primary protagonist with the most understandable goal in the series (find Sauron, stop Sauron), Galadriel had the most propulsive narrative from the beginning, yet Clark found ways to temper the character’s zeal. The weariness that came over her face as she turned away from the Undying Lands, her sadness on realizing that longtime friend Elrond doubted her mission and desperation after learning that the man for whom she’d begun to develop feelings and fought alongside was the enemy she was trying to vanquish all along — The Rings of Power’s most resonant moments came from Clark’s performance. With a glare, a sneer, and impressively fluid swordplay, she redefined the iconic elven queen on her own terms. —R.H.
Ignorance is bliss, and I know this is true, because watching Ana Fabrega play the extremely oblivious Tati on Los Espookys — sadly, for only two seasons — was a truly blissful experience. As noted in this character study, Tati redefined the television idiot: so clueless that she makes Cher Horowitz look like a Rhodes Scholar, so oblivious to how basic human interaction works that it is actually her superpower. Fabrega understands this completely, playing Tati with an air of childlike innocence and almost Zen-level spaciness. No one on television deadpans their way through a non sequitur the way Fabrega does, tossing them off with a nonchalance tinged with low-key excitement. “I have an idea for a new fruit,” she tells her sister, Úrsula. “It’s red. That’s all I have so far, because I just thought of it. But I know it doesn’t have seeds.” There are many things I will miss about Los Espookys, but her Tati is No. 1. —J.C.
.
Christina Applegate and Linda Cardellini, Dead to Me
Photo: Saeed Adyani/Netflix
At first, it seemed Dead to Me was driven by cliffhanger endings that tempted us to immediately watch the next episode. While that certainly functioned as a structural engine for the series, the real heart of this very dark comedy could be found in the relationship between its two leads: often acerbic Jen and naïvely sweet Judy. We would not have cared nearly as much about these two women if they had not been played, respectively, by Christina Applegate and Linda Cardellini, who turned dialogue exchanges into extended volleys as graceful and effortless as anything you might witness at the U.S. Open — but much funnier. In the show’s third and final season, their friendship took center stage as Cardellini’s Judy faced serious health issues and, behind the scenes, Applegate dealt with her own multiple sclerosis diagnosis while making Jen as seamlessly prickly as ever. When these two say good-bye to each other and their sugar and spikiness merge for the last time in the series finale, it’s one of the most moving moments of the entire TV year. —J.C.
By submitting your email, you agree to our
Terms and Privacy Notice
and to receive email correspondence from us. This site is protected by reCAPTCHA and the Google
Privacy Policy and
Terms of Service apply.
or
Already a subscriber?
What is your email?
This email will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
Password must be at least 8 characters and contain:
Lower case letters (a-z)
Upper case letters (A-Z)
Numbers (0-9)
Special Characters (!@#$%^&*)
This password will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
You’re in!
As part of your account, you’ll receive occasional updates and offers from New York, which you can opt out of anytime.
or
Already a subscriber?
What is your email?
This email will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
Password must be at least 8 characters and contain:
Lower case letters (a-z)
Upper case letters (A-Z)
Numbers (0-9)
Special Characters (!@#$%^&*)
This password will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
You’re in!
As part of your account, you’ll receive occasional updates and offers from New York, which you can opt out of anytime.
Already a subscriber?
Already a subscriber?
`;
// integrate Sub(x) scripts and elements
if (hostname !== 'subs.nymag.com') { // do not integrate on this subdomain
document.head.appendChild(trackingScript);
document.body.insertAdjacentHTML('beforeend', subXAnimationElements);
}
There was an error processing the request. Please try again later."}).catch(e=>console.error("Error verifying email: ",e)))(r.querySelector(".content"),o.bannerCTAVerification)})):(l.remove(),s.remove()),o.dismissable||n.remove(),o.useAlertIcon||a.remove(),r.classList.add("show"),n.addEventListener("click",()=>{u(),r.classList.remove("show")})}else r.remove()}});
}, {"1":1,"6":6,"12":12,"35":35,"40":40}];
window.modules["global-nav.client"] = [function(require,module,exports){"use strict";const dom=require(3),auth=require(12),signInButton=dom.find(".user-signin"),signOutButton=dom.find(".user-signout"),globalNav=dom.find('[class^="global-nav"]'),body=dom.find("body"),dropdownItems=dom.findAll(".dropdown-wrap"),gtm=require(1),appendLandingPageParams=require(136),pageUri=require(124).getPageUri(),subscriptionPromoLinks=dom.findAll(".persist-params"),searchString=window.location.search||"";function closeDropdowns(e){let n=globalNav.querySelectorAll(".dropdown.open");dropdownItems.forEach(function(t){let o=t.querySelector(".dropdown");!n||t.contains(e.target)&&27!==e.keyCode||o.classList.remove("open")})}function gtmSendReport(e,n,t){let o={eventCategory:"ecommerce",eventAction:"componentClick",brand:e,dimension23:"global-nav",list:pageUri,pageZone:"header",variant:"nav-link"};"global-nav-link"===t&&(o.eventLabel=n.href),gtm.reportNow(o)}function updateElementTargetUrlsIfQueryStrings(e){if(searchString){const n=new URLSearchParams(searchString);let t=e.href;if(t.includes("?")){const o=t.split("?"),i=new URLSearchParams(o[1]);for(let e of n.entries())i.set(e[0],e[1]);t=`${o[0]}?${i.toString()}`,e.href=t}else e.href=`${t}?${n.toString()}`}}function init(e){const n=e.querySelectorAll(".to-landing-page");window.addEventListener("auth:init",()=>{signInButton.addEventListener("click",function(e){e.preventDefault(),auth.showEmbeddedLoginFlow("top navigation")}),signOutButton.addEventListener("click",function(e){e.preventDefault(),gtmSendReport("Sign Out",e.target,"user-info-link"),auth.logout()}),auth.isAuthenticated()&&e.classList.add("signed-in"),auth.isSubscriber()&&e.classList.add("subscribed"),e.querySelectorAll(".user-link").forEach(e=>{e.classList.add("active")}),subscriptionPromoLinks.forEach(e=>{updateElementTargetUrlsIfQueryStrings(e)}),appendLandingPageParams(n)})}dropdownItems.forEach(function(e){e.addEventListener("click",function(){e.querySelector(".dropdown").classList.toggle("open")})}),body.addEventListener("click",closeDropdowns),document.addEventListener("keydown",closeDropdowns),globalNav.addEventListener("click",function(e){let n=e.target;n.classList.contains("global-nav-track")&>mSendReport(n.text,n,"global-nav-link")}),module.exports=init;
}, {"1":1,"3":3,"12":12,"124":124,"136":136}];
window.modules["aaa-module-mounting.legacy"] = [function(require,module,exports){"use strict";const _pickBy=require(221),_each=require(408),Fingerprint2=require(407),DS=require(406),Eventify=require(246);function registerGlobals(){window.DS=DS,window.Eventify=Eventify,window.Fingerprint2=Fingerprint2,DS.value("Eventify",Eventify),DS.value("Fingerprint2",Fingerprint2),DS.value("$document",window.document),DS.value("$window",window)}function mountDollarSliceComponents(){DS.service("components",["$document","$module",function(e,n){var o=_pickBy(n.definitions,e=>e.providerStrategy===n.providers.controller),r=Object.keys(o);function t(e){return o=>{try{n.get(e,o)}catch(e){logMountError(o,e)}}}_each(r,n=>{var o=e.querySelectorAll('[data-uri*="/_components/'+n+'/"]'),r=e.querySelectorAll('[data-uri$="/_components/'+n+'"]');_each(o,t(n)),_each(r,t(n))}),this.components=r}]),DS.get("components")}function logMountError(e,n){const o=e.outerHTML.slice(0,e.outerHTML.indexOf(e.innerHTML));console.error("Error attaching controller to "+o,n)}registerGlobals(),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{mountDollarSliceComponents()}):mountDollarSliceComponents();
}, {"221":221,"246":246,"406":406,"407":407,"408":408}];
window.modules["ads.legacy"] = [function(require,module,exports){"use strict";const _map=require(118),_forEach=require(107),_isString=require(268),_intersectionWith=require(409),_isEqual=require(274),_each=require(408),_debounce=require(182),_sortBy=require(205),page=require(124),visit=require(114);DS.service("adService",["Eventify","$cid","$document","$window",function(e,t,a,i){var o,n,s,r,d,c,u,l,g={},p=this,h=[],f=visit.getQueryParamsObject(["utm_campaign"]),m=document.querySelector('script[data-type="ad-a9"]'),b=[],w=!1,v=[],y=document.querySelector('script[data-name="ad-doubleverify"]');document.querySelector('script[data-name="concert-ads"]')||(i.NYM={},i.NYM.analytics={},i.NYM.analytics.adStartTime=i.performance.now(),i.googletag=i.googletag||{},i.googletag.cmd=i.googletag.cmd||[],u=i.googletag,(m||y)&&(i.googletag.cmd=i.googletag.cmd||[],i.googletag.cmd.push(function(){i.googletag.pubads().disableInitialLoad()})),m&&(l=i.setInterval(function(){void 0!==window.apstag&&void 0!==window.apstag.timeout&&(i.clearInterval(l),window.apstag.cleared=!0,l=null)},10),setTimeout(function(){l&&(i.clearInterval(l),i.googletag.pubads().refresh(),window.apstag||console.log("MESSAGE: Timeout for A9 load exceeded, aborting"))},500)),y&&(b.push(new Promise(function(e){w?e():v.push(e)})),c=i.setTimeout(T,2500)),o=function(e){var t,a,o=e.data,n=[];return o.loaded?e:(o.loaded=!0,t=null,(t=o.sizes?u.defineSlot(o.name,o.sizes,o.id).addService(u.pubads()):u.defineOutOfPageSlot(o.name,o.id).addService(u.pubads())).setTargeting("adid",o.id),f.hasOwnProperty("utm_campaign")&&t.setTargeting("utmcamp",f.utm_campaign),a=p.getAdCount(o.label),t.setTargeting("label",o.label+"_"+o.site+"-"+a),u.display(o.id),u.pubads().addEventListener("slotOnload",function(){i.NYM.analytics.firstAdLoadTime||(i.NYM.analytics.firstAdLoadTime=i.performance.now(),i.NYM.analytics.firstAdLoadLabel=e.data.label)}),n=_(o),Promise.all(b).then(function(){n?window.apstag&&window.apstag.cleared?window.apstag.fetchBids({slots:[n],timeout:window.apstag.timeout},function(){u.cmd.push(function(){window.apstag.setDisplayBids(),u.pubads().refresh([t],{changeCorrelator:!1})})}):y&&u.pubads().refresh([t],{changeCorrelator:!1}):u.pubads().refresh([t],{changeCorrelator:!1})}),e.slot=t,e)},n=function(e){var a,i,o,n=t(),s=e.getAttribute("data-name"),r=e.getAttribute("data-sizes"),d=e.getAttribute("data-label"),c=e.getAttribute("data-site");n=e.id,r&&r.length?(r=r.split(","),a=[],_map(r,function(e){e=e.split("x"),i=parseInt(e[0]),o=parseInt(e[1]),a.push([i,o])})):(e.classList.add("oop"),a=!1),this.data={id:n,name:s,sizes:a,loaded:!1,label:d,site:c},g[n]=this},r=function(e){u.cmd.push(function(){var t=o(e);g[e.data.id]=t})},s=function(e){var t=[];e.slot?(t=_(e))&&window.apstag&&window.apstag.cleared&&window.apstag.fetchBids({slots:[t],timeout:window.apstag.timeout},function(){u.cmd.push(function(){window.apstag.setDisplayBids(),u.pubads().refresh([e.slot],{changeCorrelator:!1})})}):e&&r(e)},u.cmd.push(function(){var e,t,o,n=page.getMeta("article:tag"),s=page.getMeta("author"),r=i.location.href,d=(e=a.head.querySelector(".head-gtm"),t=a.body.querySelector(".gtm"),e&&"top"===e.getAttribute("data-gtm")?"gtmtop":t&&"bottom"===t.getAttribute("data-gtm")?"gtmbottom":"");o=[],_forEach([n,s,d],function(e){_forEach(e.split(","),function(e){(e=e.trim().toLowerCase().replace(/\s/g,"-").replace(/\'|\’/g,"")).length&&o.push(e)})}),u.pubads().setTargeting("kw",o),u.pubads().setTargeting("entry_group",o),r=r.slice(r.lastIndexOf("/")+1),u.pubads().setTargeting("pn",r),u.companionAds().setRefreshUnfilledSlots(!0),u.pubads().enableAsyncRendering(),u.enableServices()}),this.load=r,this.create=function(e){return new n(e)},this.refresh=function(e){var t;_isString(e)?(t=this.getById(e),s(t)):s(e)},this.remove=function(e){var t=e.data.id;a.getElementById(t).innerHTML=""},this.getAdCount=function(e){var t,a=0,i=Object.keys(g);return _each(i,function(i){(t=g[i]).data.loaded&&t.data.label===e&&a++}),a},this.getById=function(e){return g[e]},d=_debounce(function(){var e={TopLeaderboard:1,RightColTopMPU:2,outOfPage:99,"homepageTakeover/TopLeaderboard":1},t=_sortBy(h,function(t){return e[t.data.label]||10});_forEach(t,function(e){return e.data.sizes?r(e):i.setTimeout(function(){r(e)},2e3)}),y&&window.PQ.cmd.push(()=>{try{window.PQ.loadSignals(["ids","bsc","vlp"],T)}catch(e){T(),console.error(`There has been an error loading Double Verify signals: ${e}`)}}),h=[]},10),this.addToPageLoadQueue=function(e){h.push(e),d()});function _(e){var t,a=e.sizes;return a=_intersectionWith(a,[[970,250],[970,90],[728,90],[300,600],[300,250],[320,100],[320,50]],_isEqual),e.sizes&&e.sizes.length&&(t={slotID:e.id,sizes:a,slotName:e.label}),t}function T(){i.clearTimeout(c),w=!0,_forEach(v,function(e){e()})}}]);
}, {"107":107,"114":114,"118":118,"124":124,"182":182,"205":205,"268":268,"274":274,"408":408,"409":409}];
window.modules["cid.legacy"] = [function(require,module,exports){"use strict";DS.service("$cid",function(){var r=Math.floor(100*Math.random());return function(){return"cid-"+ ++r}});
}, {}];
window.modules["client.legacy"] = [function(require,module,exports){"use strict";require("cid.legacy"),require("ads.legacy"),require("facebook.legacy"),require("aaa-module-mounting.legacy");
}, {"cid.legacy":"cid.legacy","aaa-module-mounting.legacy":"aaa-module-mounting.legacy","ads.legacy":"ads.legacy","facebook.legacy":"facebook.legacy"}];
window.modules["facebook.legacy"] = [function(require,module,exports){"use strict";DS.service("facebook",[function(){this.fb=function(i){window.FB&&window.FB[i].apply(this,Array.prototype.slice.call(arguments,1))}}]);
}, {}];
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o typeof key === 'string' && key.match(/\.legacy$/)).forEach(key => window.require(key));
}
function tryToMount(fn, el, name) {
try {
fn(el); // init the controller
} catch (e) {
const elementTag = el.outerHTML.slice(0, el.outerHTML.indexOf(el.innerHTML));
console.error(`Error initializing controller for "${name}" on "${elementTag}"`, e);
}
}
/**
* mount client.js component controllers
*/
function mountComponentModules() {
Object.keys(window.modules).filter(key => typeof key === 'string' && key.match(/\.client$/)).forEach(key => {
let controllerFn = window.require(key);
if (typeof controllerFn === 'function') {
const name = key.replace('.client', ''),
instancesSelector = `[data-uri*="_components/${name}/"]`,
defaultSelector = `[data-uri$="_components${name}"]`,
instances = document.querySelectorAll(instancesSelector),
defaults = document.querySelectorAll(defaultSelector);
for (let el of instances) {
tryToMount(controllerFn, el, name);
}
for (let el of defaults) {
tryToMount(controllerFn, el, name);
}
}
});
}
// Make sure that a `window.process.env.NODE_ENV` is available in the client for any dependencies,
// services, or components that could require it
// note: the `` value is swapped for the actual environment variable in /lib/cmd/compile/scripts.js
window.process = window.process || {};
window.process.env = window.process.env || {};
if (!window.process.env.NODE_ENV) {
window.process.env.NODE_ENV = '';
}
// note: legacy controllers that require legacy services (e.g. dollar-slice) must
// wait for DOMContentLoaded to initialize themselves, as the files themselves must be mounted first
mountLegacyServices();
mountComponentModules();
// ]]