President Donald Trump refused to sign a 2018 spending bill until former GOP House Speaker Paul Ryan agreed to let him first build suspense on Twitter, according to a new book by the journalist Tim Alberta.

Trump reportedly chewed Ryan out over the bill because of its lack of border-wall funding, but then signed the legislation after Ryan agreed to let him air his grievances on Twitter.

Alberta also documented how Ryan and other top Republicans dreaded Trump's often unexpected, insult-ridden, and factually inaccurate tweetstorms.

Ryan reportedly responded to one early-morning presidential tweetstorm with "maniacal, punch-drunk laughter."

Visit Business Insider's homepage for more stories.

President Donald Trump refused to sign a 2018 spending bill until former GOP House Speaker Paul Ryan agreed to let him first build suspense on Twitter, according to a new book by the journalist Tim Alberta.

Trump chewed Ryan out over the bill because of its lack of border-wall funding, but then signed the legislation after Ryan agreed to let him air his grievances on Twitter, Alberta wrote in "American Carnage: On the Front Lines of the Republican Civil War and the Rise of President Trump," according to The Washington Post, which obtained an advanced copy.

After Trump signed the bill, Ryan praised the president on Twitter.

Alberta also documented how Ryan and other top Republicans dreaded Trump's often unexpected, insult-ridden, and factually inaccurate tweetstorms.

Trump called Reince Priebus, his chief of staff at the time, early on a Saturday morning in March 2017 to get his thoughts on a series of tweets he wrote accusing former President Barack Obama of surveilling his presidential campaign in 2016, The Washington Post reported.

Read more: Trump's assistant Madeleine Westerhout was reportedly crying and 'inconsolable' on election night 2016 — but now says she'd do almost anything for Trump

"Terrible! Just found out that Obama had my 'wires tapped' in Trump Tower just before the victory. Nothing found. This is McCarthyism!" Trump tweeted in a series of morning messages, calling Obama a "bad (or sick) guy" in another tweet.

Priebus quickly picked up the phone and called Ryan to discuss the president's unsubstantiated claims.

"Paul, what the hell is going on? What the hell is he talking about?" Priebus asked his GOP ally, according to Alberta.

Ryan responded with "maniacal, punch-drunk laughter," according to The Washington Post.