鍍金池/ 問答/HTML/ _aStomp2.default.Stomp.debug is not a fu

_aStomp2.default.Stomp.debug is not a function?Date.now怎么理解?

now = function() {
            if (Date.now) {
                return Date.now();
            } else {
                return new Date().valueOf;
            }
        };

Date.now 是什么意思?

/*
 *  時(shí)間:2018年1月28日
 */

(function() {
    var Byte, Client, Frame, Stomp,
        __hasProp = {}.hasOwnProperty,
        __slice = [].slice;

    Byte = {
        LF: '\x0A',
        NULL: '\x00'
    };



    Client = (function() {
        var now;

        function Client(ws) {
            this.ws = ws;
            this.ws.binaryType = "arraybuffer";
            this.counter = 0;
            this.connected = false;
            this.heartbeat = {
                outgoing: 10000,
                incoming: 10000
            };
            this.maxWebSocketFrameSize = 16 * 1024;
            this.subscriptions = {};
            this.partialData = '';
        }

        Client.prototype.console = function(message) {
            console.log(message)
        };

        Client.prototype.debug = function(message) {
            var _ref;
            return typeof window !== "undefined" && window !== null ? (_ref = window.console) != null ? _ref.log(message) : void 0 : void 0;
        };

        now = function() {
            if (Date.now) {
                return Date.now();
            } else {
                return new Date().valueOf;
            }
        };



        return Client;

    })();

    Stomp = {
        VERSIONS: {
            V1_0: '1.0',
            V1_1: '1.1',
            V1_2: '1.2',
            supportedVersions: function() {
                return '1.1,1.0';
            }
        },
        client: function(url, protocols) {
            var klass, ws;
            if (protocols == null) {
                protocols = ['v10.stomp', 'v11.stomp'];
            }
            klass = Stomp.WebSocketClass || WebSocket;
            ws = new klass(url, protocols);
            return new Client(ws);
        },
        over: function(ws) {
            return new Client(ws);
        },
        Frame: Frame
    };

    if (typeof exports !== "undefined" && exports !== null) {
        exports.Stomp = Stomp;
    }

    if (typeof window !== "undefined" && window !== null) {
        Stomp.setInterval = function(interval, f) {
            return window.setInterval(f, interval);
        };
        Stomp.clearInterval = function(id) {
            return window.clearInterval(id);
        };
        window.Stomp = Stomp;
    } else if (!exports) {
        self.Stomp = Stomp;
    }

}).call(this);
import React from 'react';
import AStomp from '../../utils/aStomp'

class Basic extends React.Component {

    constructor() {
        super();
    }

    componentDidMount() {
        var aClient;
        aClient = AStomp.Stomp.client('ws://10.0.5.232:61623');
        aClient.console('消息到來了');
        console.log(new Date().valueOf)
        AStomp.Stomp.debug('debug')
    }

    render() {
        var divStyle = {

        }

        return (

            <div id style={divStyle} className='data-line'>
                <h1>indexStomp</h1>
                <h1>A</h1>
            </div>
        )
    }
}

export default Basic;

圖片描述

AStomp.Stomp.client.debug('debug')

圖片描述

回答
編輯回答
故人嘆

1.Date.now是返回當(dāng)前時(shí)間的時(shí)間戳,但是不是所有的瀏覽器都支持
2.應(yīng)該是用AStomp.Stomp.client.debug('debug')

2017年1月17日 20:32