Added a waitfor which makes it possible to delay the loading of a resource until some conditions are met
Added a demo for the waitfor feature