cloud function pubsub .onRun .onPublish code example

Example: pub schedule firebase

import {EventContext} from 'firebase-functions';
// There is an allowance of three free jobs per Google account
//  For example, to run a function every five minutes with 
//  AppEngine cron.yaml syntax, do something like this:
export const scheduledFunction = 
      functions.pubsub.schedule('every 5 minutes').onRun(
          (context: EventContext) => {
            console.log('This will be run every 5 minutes!');
            return new Promise();
     });