Seems it takes in engine heat. When I have my heat on my engine stays on longer. If I turn the heat off, then the engine turns off too if the battery has charge. After the engine is hot enough and the interior is warmed up, the engine turns off. Electric heat would take up way too much energy.
I am fairly certain on cars like the Leaf, the heat is all done by electricity, which I also believe I read drastically reduces the range of the car.