【问题标题】:JayData : how to migrate code from v1.3 to v1.5JayData:如何将代码从 v1.3 迁移到 v1.5
【发布时间】:2017-01-26 22:22:33
【问题描述】:

我有一些在 JayData 1.3 中工作的代码。

由于 1.3 版本与聚合物的兼容性问题,我需要将 JayData 升级到 1.5。

upgrade instructions 说您可以使用“jaydata-compatibility.js”脚本“将您的应用程序从以前的版本逐步升级到 JayData 1.5.x”,但是当我按照描述添加它时,我只是得到了错误,“typeOrName requires a value other than undefined or null”,实际上根本无法帮助我逐步完成升级。

这里是 JayData 1.3 代码:

$data.Entity.extend('Cache', {
    'id': { 'type': 'int', 'key': true, 'computed': true },
    'url': { 'type': 'string' },              
    'method': { 'type': 'string', 'required': true },   
    'dts': { 'type': 'string', 'required': true },    
    'encryptMeth': { 'type': 'string' },  
    'data': { 'type': 'string' }
});

$data.EntityContext.extend('APIWrapperDB', {
    'Cache': { 'type': $data.EntitySet, 'elementType': Cache }
});

var cacheDatabase = new APIWrapperDB('TheAPIWrapperDatabase');

cacheDatabase.onReady( function() { /* now my DB is ready */ };

此代码的 JayData 1.5 等效项是什么?

【问题讨论】:

    标签: javascript polymer jaydata


    【解决方案1】:

    这是更新后的 sn-p,我刚刚将您的实体定义声明为变量,因为 JayData 停止使用全局对象。

    var Cache = data.Entity.extend('Cache', {
        'id': { 'type': 'int', 'key': true, 'computed': true },
        'url': { 'type': 'string' },              
        'method': { 'type': 'string', 'required': true },   
        'dts': { 'type': 'string', 'required': true },    
        'encryptMeth': { 'type': 'string' },  
        'data': { 'type': 'string' }
    });
    
    var APIWrapperDB = $data.EntityContext.extend('APIWrapperDB', {
        'Cache': { 'type': $data.EntitySet, 'elementType': Cache }
    });
    
    var cacheDatabase = new APIWrapperDB('TheAPIWrapperDatabase');
    
    cacheDatabase.onReady( function() { /* now my DB is ready */ };
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-19
      • 1970-01-01
      • 2014-06-05
      • 2012-08-11
      • 2016-12-13
      • 2014-11-05
      相关资源
      最近更新 更多