dojo

Dojo Store 概念详解

这一生的挚爱 提交于 2019-11-29 09:41:15
翻译自 https://github.com/dojo/framework/blob/master/docs/en/stores/supplemental.md State 对象 在现代浏览器中, state 对象是作为 CommandRequest 的一部分传入的。对 state 对象的任何修改都将转换为相应的 operation,然后应用到 store 上。 import { createCommandFactory } from '@dojo/framework/stores/process'; import { State } from './interfaces'; import { remove, replace } from '@dojo/framework/stores/state/operations'; const createCommand = createCommandFactory<State>(); const addUser = createCommand<User>(({ payload, state }) => { const currentUsers = state.users.list || []; state.users.list = [...currentUsers, payload]; }); 注意,IE 11 不支持访问 state

Fast, lightweight XML parser [closed]

前提是你 提交于 2019-11-29 09:37:59
I have a specific format XML document that I will get pushed. This document will always be the same type so it's very strict. I need to parse this so that I can convert it into JSON (well, a slightly bastardized version so someone else can use it with DOJO). My question is, shall I use a very fast lightweight (no need for SAX, etc.) XML parser (any ideas?) or write my own, basically converting into a StringBuffer and spinning through the array? Basically, under the covers I assume all HTML parsers will spin thru the string (or memory buffer) and parse, producing output on the way through.

Dojo Store 简介

我与影子孤独终老i 提交于 2019-11-29 09:35:38
翻译自 https://github.com/dojo/framework/blob/master/docs/en/stores/introduction.md 介绍 Dojo store 提供可预测的、一致的状态容器,内置了对共享状态管理模式的支持。 Dojo store 包提供了一个集中式存储,为应用程序提供真正的单一数据源。Dojo 应用程序的操作使用单向数据流;因此,所有应用程序数据遵循相同的生命周期,确保应用程序逻辑是可预测的,且易于理解。 功能 描述 全局数据存储 应用程序状态全局存储在真正的单一数据源中。 单向数据流 可预测的、全局的应用程序状态管理。 类型安全 对状态的访问和修改都受接口的保护。 操作驱动的状态变更 封装的、定义良好的状态修改,可以记录、撤消和重放。 异步支持 开箱即用的异步命令(command)支持。 操作中间件 在操作前和操作后进行错误处理和数据转换。 简单的部件集成 提供与 Dojo 部件轻松集成的工具和模式。 基本用法 Dojo 提供了一种响应式架构,能够持续修改和渲染应用程序的当前状态。在简单系统中,这通常发生在部件内部,并且部件可以修改自己的状态。然而,随着系统变得越来越复杂,就需要更好的划分和封装数据,并随着快速增长创建一个清晰的隔离。 Store 提供了一个清晰的接口,通过单向数据流对全局对象进行存储、修改和检索。Store

How to prevent Meteor from watching files?

余生长醉 提交于 2019-11-29 09:15:51
I would like to use Dojo Toolkit with Meteor . I first copy the whole Dojo Toolkit tree in /public Then, I include it on the client side with: <script src="/dojo/dojo.js" data-dojo-config="async: true"></script>` Everything works fine, except Meteor is actually monitoring every single file in /public for changes, so that it can restart the server. This is actually causing a very long delay during the first request on localhost:3000 . Is there a way of preventing Meteor from watching files from a certain directory? Dojo Toolkit is 10k+ files so I get the EMFILE error stated here , corrected

Adding dojo widget inside custom widget

杀马特。学长 韩版系。学妹 提交于 2019-11-29 08:13:11
I am making a small dojo widget, basically extending the dailog widget and want to add simple widgets like a text input a few labels etc. How do i go about this? I am following a tutorial, Dojo how to make a widget Please help me out. Thanks First. I'am not good at english, but will do at my best. This is the path of my widget. Here. The important code in the js file that must declare. dojo.provide("gissoft.dijit.widgetOam"); dojo.require("dojo.parser"); dojo.require("dijit._Widget"); dojo.require("dijit._Templated"); dojo.declare("gissoft.dijit.widgetOam", [dijit._Widget, dijit._Templated], {

How to generate a right-click event in all browsers

谁都会走 提交于 2019-11-29 08:05:25
A little context: The app I'm working on has a right-click context menu for certain objects on the screen. The current design as that each of these objects listens for a right-click, sends an AJAX request to get the context data for that object, uses that data to create a PopupMenu2 from Dojo 0.4.3 (I know!), and then generates a right-click to launch the Dojo menu. I'm trying to figure out a way to generate a right-click event for all browsers. Currently, we only support IE and use the oncontextmenu event. Restrictions: No jQuery :( I cannot pre-load all the data for the objects on screen to

How to build Dojo into a single file, given a list of dependencies?

时光总嘲笑我的痴心妄想 提交于 2019-11-29 07:58:36
问题 I have a simple Dojo application, that does only one require call, loading all the dependencies. The trouble is, while it is extremely simple, it still ends up loading ~100 files from server. I tried to solve that problem using Dojo build system, but seems I don't have a deep enough understanding. So my question is - given a list of dependencies, like the following: ["dojo/parser", "dijit/registry", "dojo/dom", "dojo/on", "dojo/query", "dojo/dom-class", "dojo/request", "dijit/form

loading html page inside div

喜欢而已 提交于 2019-11-29 07:31:29
how can I load an html page inside a div. With the 'object' tag it's loading, but I think it's not a good approach. It is not an external file. Is dojo good for this? Use jquery $("#mydiv").load("myexternalfile.html"); I'm not completely sure what you're looking for, but if you're wishing to display an HTML document inside another HTML document then I think the only way to do this is to use an iframe . Check out this tutorial: http://www.designplace.org/tutorials.php?page=1&c_id=1 Perhaps you could load the HTML document and strip away the HEAD and wrapping BODY elements and then insert the

How can I load my own js module with goog.provide and goog.require?

倾然丶 夕夏残阳落幕 提交于 2019-11-29 07:24:50
问题 We are trying to switch the packaging for our project from dojo to google closure, but we haven't had any luck so far. Here is a simple example that illustrates what we are trying to accomplish: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="runtime/src/core/lib/goog-rev26/base.js"></script> <script> goog.require("foo.bar"); function main() {foo.bar.echo("hello world")} </script> </head> <body onload="main()"> </body> </html> Then in /foo/bar.js I have:

What does Dojo consider a XHR request error?

旧城冷巷雨未停 提交于 2019-11-29 07:15:44
When doing AJAX through Dojo we can pass two callbacks, one to execute after a successfull request and one to execute after an error: dojo.xhr("GET",{ url: myURL, content: messageContents, load: function(returnData, ioArgs){ //This is called on success }, error: function(returnData, ioArgs){ //This is called on failure } }); I couldn't find in the documentation what is defined as an error . I'd guess anything with a return code >= 400 but I'm not sure. Generally speaking, an unsuccessful HTTP response code. The determination is made by calling dojo._isDocumentOk which as you'll see basically