Oh, fellow royal children of Siam, at last the day we always knew was coming has arrived. The most important television show any of us have ever witnessed in our present lifetimes has been finally been moved into the part of the hospice where they no longer show Gerard Butler movies in the solarium to prepare you for death. Start calling the kids and tell them yes, it’s time and yes, they can put the plane tickets on your credit card. For the end is nigh. The Sword of Damocles (with whom Anjelica Huston had a brief fling after a meet-cute in the Temple of Dionysus social hall in Hellenist Sicily) has fallen. Smash will not be returning next year.
I know you all have a lot of questions, which I’ll be addressing later this afternoon at the press conference in the Rose Garden, in which I deliver remarks firmly and unequivocally terming the treatment and subsequent cancellation of Smash as “an act of terror,” a view I will reiterate when I am called to testify before the oversight committee Congressional Republicans plan to convene later this month (Lindsey Graham told me about it when I ran into him at Marie’s Crisis the other night.) But for now, though we are all mourning in our own ways/having overpriced brunch with our drag mothers, let’s turn our attention to the task at hand, which is reliving an episode that appropriately enough, is all about betrayal, conspiracy, and the proverbial “stab-in-the-back” that Adolf Hitler describes in Mein Kampf (which Lindsey also told me he’s planning to read from at the next installment of Celebrity Autobigraphy. McCain called Debbie Reynolds, how much his esteemed colleague from Tennessee wanted it. “Typical bossy bottom,” sighed Lindsey, as we launched into a raucous sing-a-long of “Some People.”)
Ah so. Hit List is now in previews, making the difficult transition to the big time with all the heart, soul and authenticity of a “Kelly Osbourne for Ann Taylor” capsule collection runway show, and bringing legendary director Derek Wills one step closer to his dream of re-imagining A Night At the Roxbury for the Broadway stage, complete with flashing lights, idiosyncratically sparkly outfits, and hordes of leggy Ukrainian teenagers looked for “clean, friendly and strong American or British senior citizen to be traditional wife to.” What I’m saying, basically, is that Derek’s artistic vision is utterly indistinguishable from that of the Prague nightclub in Prague where I lost my passport in 1999 (the aftermath of this being the basis for the Bridget Jones meets John le Carré novel I will probably never write.)
And yet! It’s still not perfect! How can this be? Jimmy — who overnight has been transformed into a model of savvy perfectionist professionalism — and my Cousin Debbie — on whose behalf my Aunt Phyllis has asked me to release the following statement: “I’m very proud of my daughter and God knows I don’t want to be a bother, but what, she’s so busy with this farkakte Chick Lit or whatever it’s called she can’t even send a tiny little card on time?” — think that all they need is one big, youth-oriented and impossible-to-implement idea of the sort our dear departed Kyle Goblinweed was so adept at plucking from his tiny buttercup pollen dreams, but Derek says no! No! The problem is Midriff! Midriff, who was so outrageously talented and beloved of Richard “Henry” Francis of the New York Times that they rewrote the entire show around her is now “making too many mistakes,” like she’s a figure skater who can’t get through her long program.
And obviously the best way to make sure no “mistakes” are made is to replace her with an understudy who has never done the show before, namely Daisy, the taut little Pilates mat who was planning to sue Derek for sexual harassment until she decided it would be more useful to sleep with him after Ivy got famous and was like, “Bitch, Craig Bierko just sent me a huge bouquet of stargazer lilies and three pairs of still-warm boxer briefs, so you can just go find some other bowl of tangy marinara to stick your unlimited breadsticks in.” Midriff, who has seen this all before, is understandably paranoid/fatalistic about how this is going to play out, but Karen, looking particularly glossy in this episode, by which I mean she is literally a half-used pot of that pastel Body Shop lip gloss that was all the rage in 1994, and so sticky that even now I am still finding sickly traces of its kiwi-scented residue on the walls and shelves of my childhood bedroom in Omaha, from which I write to you now, surrounded by a collection of ceramic comedy/tragedy masks and photographic evidence of my natural hair color, tells Midriff that Derek is just testing her, and she’ll “talk to him.” Which she does, to which he responds with his usual surly surls of “DON’T QUESTION ME! MIDRIFF IS TIRED, TIRED!!! THIS IS WHAT KYLE GOBLINWEED WOULD HAVE WANTED, FOR ME TO CONTINUE TO HAVE NUBILE YOGA SEX WITH A FLINTY SPANDEX-CLAD PIECE OF EXERCISE EQUIPMENT! HAPPY FUCKING MOTHERS’ DAY!!”
Meanwhile, Anjelica Huston has one word swimming through the fiery neural-pathways of her starshine brain, and it is Tony! Tonys for everyone! Tony Tony Tone! And maybe it’s the fact she is never seen in this episode without a Martini in her hand, or maybe it’s just the fact I’m home and my mother seems to toss the phrase around every time someone tries to get a fucking drink around here to like, sip while getting dressed or watching TV or eating breakfast, but do you think Eileen Rand might be a functioning alcoholic? Anyway, apart from the unstoppable rise of the youth-oriented Eurovision jukebox musical Hit List, Mimi from Rent has uncovered three barriers to Bombshell’s sweeping the awards: 1) Tom is a shitty director for whom it really will be an honor “just to be nominated”; 2) He and Julia are breaking up and hating each other and spending most of their time arguing over who is going to get that lamp that neither of them liked anyway; 3) the Village Voice has characterized Ivy as a pill-popping peroxide blonde who slept her way to the top, and no one seems to have done the due diligence to realize that Michael Musto means that as the highest compliment.
And what is the solution? Why, a festival! A festival? A festival! We’re all going to go the festival, and dance before Hal Prince! The festival, in this case, will be a Houston & Leavitt tribute night, which will leave everyone with a warm, sticky feeling on their minds and in their pants. Tom will direct it and play the piano. Ivy, in keeping with the new, wholesome “Norma Jean” image Mimi from Rent has ordered her to maintain, will perform a number set in an Amsterdam red-light sex show in which she will either insert an unpeeled yam into her rectum (“I’ve said it before: a musical can be built around the work of the NEA Four”—“Cousin” Rachel Shukert) or write the word “HOT” with a Sharpie clamped in her cervix on the bare, quivering torso of Joe Mantello, depending on his availability. And as part of an elaborate vow-renewal ceremony designed by world-renowned event planner Kevin Lee, Cousin Debbie will also sing? “You want moi to sing?” Cousin Debbie gasps, furiously nodding, then shaking her head in a one-woman recreation of the “No, no, no, yes, yes, yes” scene from Singing’ in the Rain.
Or at least, that’s what she would have done, if anyone knew where the hell she was! If she hadn’t been spending all her time rustling through Kyle Goblinweed’s now-empty next with Jimmy, trying to make sense of the runic symbols scratched on flower petals and cicada wings and the enormous stacks of decades-old Playbills that are found in every gay man’s home after his death. Did he leave some final instruction, some last goodbye? Yes! Yes!!! Here it is, scribbled on the back of a partly nibbled condom wrapper from Pieces. The big idea that will save Hit List, and therefore, humanity, is to send a whole bunch of text messages and tweets and Facebook posts to the audience during the show, so that they can read them immediately on their cell phones that are supposed to be turned off! What genius! What art! Another Chromolume, George!
Anyway, it’s time for the show. And finally, we get a real answer to Carpet’s tearful question of what was going to happen to his Chinese baby sister, Jeremy Lin-Manuel Miranda, if Cousin Debbie and Unfrozen Caveman Husband didn’t adopt her into their earth-toned, salad-strewn misery nest! She was adopted by nice Puerto Rican family in Inwood, who discovered she was actually a boy, and grew up to be the Tony-award winning composer and lyricist of In the Heights! (Don’t question me on the timeline; we know that years pass differently in soap operas, which is why Erica Kane is still 29 years old and so is her daughter, Bianca.) And boy, does he have some shade to throw at Tom, especially now that the news has been mysteriously leaked that he and Cousin Debbie are breaking up. By who, might nobody ask? Oh, probably Jerry, says Anjelica Huston, although secretly, she orchestrated the whole thing, because please, who isn’t going to give them the Tony as a goodbye present to a terminally ill artistic collaboration? The governing body of the Tony Awards basically functions as a less nail-biting version of the Make-A-Wish foundation — I mean, why do you think Catherine Zeta-Jones won that time? And just as a gesture of good faith, the way everyone has sex one last time in their apartment before they leave for good. Cousin Debbie shows up at the very last moment … to sing. Yes, sing. So we get to end things on a nice, loving note between friends. Mommy and Daddy might be splitting up, but that doesn’t mean they don’t still love you very much, you know?
As for the Derek situation, the crack sleuthing team of Midriff and Karen (who, as I forgot to tell you earlier, Ivy mistook for a crumpled Duane Reade bag that somehow got stuck to her shoe in Times Square, and who NBC is now building a Cagney and Lacey–style procedural around in a not at all doomed attempt to re-brand Katharine McPhee as a butt-kicking Michelle Monaghan–type action star, but don’t worry McPhans, she’ll still sing!) figured out there must be more to the whole Daisy situation than him being a festering exoskeleton of a human being who has fallen into compulsive and manipulative sex addiction in order to constantly prove to himself that despite spending an inordinate amount of his adult life in jazz shoes and a dance belt, he is not a gay, okay? And they’re right — apparently he made some kind of promise to Daisy the Reformer that he would give her some tat if she gave him some tit, and she taped the whole thing, and also their sex, maybe? Which she is threatening to make public and/or sell (because if Farrah Abraham got a million dollars for her sex tape, night-vision footage of middle-aged British musical theater director looking incredibly depressed while getting a blowjob from some anonymous step aerobics instructor has got to be worth at least 50 grand.) Midriff will get another job, but Derek has a career to protect. “We’ll see about that,” snaps Midriff, proving once again that she is the only character on this show with any sense as she immediately speed-dials her lawyer.
Meanwhile, Ivy is also concerned about Midriff getting screwed over, because she is an empathetic person who respects hard-work, professionalism and talent. And can I just say that one of the most amazing — and I have to say, endearing — things about Smash, now that we’re almost at the end, is how Ivy has become the voice of the audience? I mean, at the beginning, we were all supposed to identify with Karen, all wide-eyed and innocent and Midwestern and Jesus-loving, and now it’s Ivy, a slightly blowsy trooper whose been around the block, good times and bum times she’s seen them all, she literally danced in her scanties tonight, and she’s still here? Isn’t this proof that it does get better? That maybe we don’t need it to be Morning in America, because we’ve figured out that cocktail hour is a whole lot more fun?
And just to drive that point home, Karen explains it all for us, “Oh, it’s just that Daisy slept with him for the part, you know, just like you did.” If there was ever a time to throw a drink in someone’s face, that was it. And yet, we couldn’t risk ruining Katharine McPhee’s makeup, so instead, Ivy says what the rest of us have been screaming at the television for what seems like an entire decade now (and which has certainly taken at least that off my life): “Karen Cartwright, you are a smug, stupid, fucking bitch. A dragon is not a slave! Unsullied, slay all the masters! Slay all the soldiers! Slay anyone holding a whip!”
Oh, and surprise! Ivy is pregnant. What the what. Happy fucking Mothers’ Day.
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,"17":17,"35":35,"40":40}];
window.modules["global-nav.client"] = [function(require,module,exports){"use strict";const dom=require(4),auth=require(17),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(135),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 i=t.querySelector(".dropdown");!n||t.contains(e.target)&&27!==e.keyCode||i.classList.remove("open")})}function gtmSendReport(e,n,t){let i={eventCategory:"ecommerce",eventAction:"componentClick",brand:e,dimension23:"global-nav",list:pageUri,pageZone:"header",variant:"nav-link"};"global-nav-link"===t&&(i.eventLabel=n.href),gtm.reportNow(i)}function updateElementTargetUrlsIfQueryStrings(e){if(searchString){const n=new URLSearchParams(searchString);let t=e.href;if(t.includes("?")){const i=t.split("?"),o=new URLSearchParams(i[1]);for(let e of n.entries())o.set(e[0],e[1]);t=`${i[0]}?${o.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()||auth.isMobileAppRequest())&&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,"4":4,"17":17,"124":124,"135":135}];
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","ads.legacy":"ads.legacy","facebook.legacy":"facebook.legacy","aaa-module-mounting.legacy":"aaa-module-mounting.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();
// ]]